#include <cstdio> #define MAX_SIZE 250004 int bears[MAX_SIZE][2]; int bears_tmp[MAX_SIZE][2]; int n; int main() { //freopen("test1.in", "r", stdin); scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &bears[i][0], &bears[i][1]); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { bears_tmp[j][0] = bears[j][0]; bears_tmp[j][1] = bears[j][1]; } for (int j = 0; j < n; j++) { if (j == i) { continue; } for (int k = 0; k < n; k++) { if (k == j || k == i) { continue; } if (bears_tmp[k][0] < bears_tmp[j][0]) { bears_tmp[k][0]++; } else if (bears_tmp[k][0] > bears_tmp[j][0]) { bears_tmp[k][0]--; } if (bears_tmp[k][1] < bears_tmp[j][1]) { bears_tmp[k][1]++; } else if (bears_tmp[k][1] > bears_tmp[j][1]) { bears_tmp[k][1]--; } } } long long int sumaIloczyn = 0; for (int j = 0; j < n; j++) { sumaIloczyn += bears_tmp[j][0] * bears_tmp[j][1]; } printf("%lld\n", sumaIloczyn); } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #include <cstdio> #define MAX_SIZE 250004 int bears[MAX_SIZE][2]; int bears_tmp[MAX_SIZE][2]; int n; int main() { //freopen("test1.in", "r", stdin); scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &bears[i][0], &bears[i][1]); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { bears_tmp[j][0] = bears[j][0]; bears_tmp[j][1] = bears[j][1]; } for (int j = 0; j < n; j++) { if (j == i) { continue; } for (int k = 0; k < n; k++) { if (k == j || k == i) { continue; } if (bears_tmp[k][0] < bears_tmp[j][0]) { bears_tmp[k][0]++; } else if (bears_tmp[k][0] > bears_tmp[j][0]) { bears_tmp[k][0]--; } if (bears_tmp[k][1] < bears_tmp[j][1]) { bears_tmp[k][1]++; } else if (bears_tmp[k][1] > bears_tmp[j][1]) { bears_tmp[k][1]--; } } } long long int sumaIloczyn = 0; for (int j = 0; j < n; j++) { sumaIloczyn += bears_tmp[j][0] * bears_tmp[j][1]; } printf("%lld\n", sumaIloczyn); } return 0; } |