Submission #869386

# Submission time Handle Problem Language Result Execution time Memory
869386 2023-11-04T09:02:09 Z shdfshdfshdf Ideal city (IOI12_city) C++17
0 / 100
21 ms 2132 KB
#include <bits/stdc++.h>
using namespace std;

int DistanceSum(int n, int *x, int *y){
    int minx=4294967295, miny=4294967295;
    for (int a=0; a<n; a++) {
        minx=min(minx, x[a]);
        miny=min(miny, y[a]);
    }
    for (int a=0; a<n; a++) {
        x[a]-=minx;
        y[a]-=miny;
    }
    sort(x, x+n);
    sort(y, y+n);
    int bx=0, by=0;
    for (int a=0; a<n; a++) {
        bx+=x[a]-x[0];
        by+=y[a]-y[0];
    }
    int ans=bx+by;
    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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 5 ms 764 KB Output is correct
2 Correct 4 ms 560 KB Output is correct
3 Correct 10 ms 1112 KB Output is correct
4 Correct 10 ms 1112 KB Output is correct
5 Correct 21 ms 1880 KB Output is correct
6 Correct 21 ms 1880 KB Output is correct
7 Correct 21 ms 2132 KB Output is correct
8 Correct 20 ms 1884 KB Output is correct
9 Correct 21 ms 1824 KB Output is correct
10 Incorrect 21 ms 1840 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -