# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
109504 |
2019-05-06T18:24:14 Z |
pamaj |
Ideal city (IOI12_city) |
C++14 |
|
9 ms |
896 KB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int prefx[maxn], prefy[maxn];
int DistanceSum(int N, int *X, int *Y)
{
sort(X, X + N);
sort(Y, Y + N);
for(int i = 0; i < N; i++)
{
if(!i) prefx[i] = X[i], prefy[i] = Y[i];
else prefx[i] = X[i] + prefx[i - 1], prefy[i] = Y[i] + prefy[i - 1];
}
int sum = 0;
for(int i = 0; i < N - 1; i++)
{
sum += prefx[N] - prefx[i] - (N - i)*X[i];
sum += prefy[N] - prefy[i] - (N - i)*Y[i];
}
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |