# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
39080 |
2018-01-09T08:05:16 Z |
14kg |
Ideal city (IOI12_city) |
C++11 |
|
1000 ms |
2104 KB |
#define MOD 1000000000
#define INF 2147483646
#define min2(x,y) (x<y?x:y)
int n;
int cnt_X[100001], cnt_Y[100001];
int DistanceSum(int _n, int *X, int *Y) {
n = _n;
int x_min=INF, y_min=INF;
long long out = 0, t1, t2, t3;
for (int i = 0; i < n; i++) x_min = min2(x_min, X[i]), y_min = min2(y_min, Y[i]);
for (int i = 0; i < n; i++) cnt_X[X[i] - x_min]++, cnt_Y[Y[i] - y_min]++;
for (int i = 0; i<n; i++)
for (int j = i + 1; j < n; j++) {
t1 = cnt_X[i], t2 = cnt_X[j], t3 = j - i;
out += (t1*t2*t3) % MOD, out %= MOD;
}
for (int i = 0; i<n; i++)
for (int j = i + 1; j < n; j++) {
t1 = cnt_Y[i], t2 = cnt_Y[j], t3 = j - i;
out += (t1*t2*t3) % MOD, out %= MOD;
}
return (int)out;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
2104 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
2104 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |