# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869397 | 2023-11-04T09:09:47 Z | teacup | Ideal city (IOI12_city) | C++14 | 26 ms | 1524 KB |
#include <bits/stdc++.h> using namespace std; int DistanceSum(int N, int *X, int *Y){ int minx=(1<<32)-1, miny=(1<<32)-1; for (int a=0; a<N; a++) { minx = min(minx, X[a]); miny = min(miny, Y[a]); } sort(X, X+N); sort(Y, Y+N); long long bx=0, by=0; for (int a=0; a<N; a++) { bx+=(X[a]-X[0]); by+=(Y[a]-Y[0]); } long long ans=(bx+by)%1000000000; for (int a=1; a<N; a++) { bx-=(N-a)*(X[a]-X[a-1]); by-=(N-a)*(Y[a]-Y[a-1]); ans=(ans+bx+by)%1000000000; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 604 KB | Output is correct |
2 | Correct | 5 ms | 648 KB | Output is correct |
3 | Correct | 10 ms | 860 KB | Output is correct |
4 | Correct | 10 ms | 856 KB | Output is correct |
5 | Correct | 20 ms | 1524 KB | Output is correct |
6 | Correct | 22 ms | 1112 KB | Output is correct |
7 | Correct | 21 ms | 1112 KB | Output is correct |
8 | Correct | 19 ms | 1116 KB | Output is correct |
9 | Correct | 26 ms | 1372 KB | Output is correct |
10 | Correct | 20 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |