# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
109516 |
2019-05-06T18:51:29 Z |
pamaj |
Ideal city (IOI12_city) |
C++14 |
|
11 ms |
1152 KB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
typedef long long ll;
ll prefx[maxn], prefy[maxn];
int DistanceSum(int N, int *X, int *Y)
{
ll x[maxn];
ll y[maxn];
for(int i = 0; i < N; i++)
{
x[i] = X[i];
y[i] = Y[i];
}
sort(x, x + N);
sort(y, y + N);
for(int i = 0; i < N; i++)
{
if(i == 0) prefx[i] = x[i], prefy[i] = y[i];
else prefx[i] = x[i] + prefx[i - 1], prefy[i] = y[i] + prefy[i - 1];
//cout << prefx[i] << " " << prefy[i] << "\n";
}
ll sum = 0;
for(int i = 0; i < N - 1; i++)
{
sum += prefx[N - 1] - prefx[i] - (N - i)*x[i];
sum += prefy[N - 1] - 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 |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1152 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1152 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |