Submission #869374

# Submission time Handle Problem Language Result Execution time Memory
869374 2023-11-04T08:42:28 Z shdfshdfshdf Ideal city (IOI12_city) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> coor;
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+=bx+by;
    }
    return ans;
};

Compilation message

/usr/bin/ld: /tmp/ccYJZwKB.o: in function `main':
grader.cpp:(.text.startup+0x104): undefined reference to `DistanceSum(int, int*, int*)'
collect2: error: ld returned 1 exit status