Submission #869397

#TimeUsernameProblemLanguageResultExecution timeMemory
869397teacupIdeal city (IOI12_city)C++14
23 / 100
26 ms1524 KiB
#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 (stderr)

city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:5:16: warning: left shift count >= width of type [-Wshift-count-overflow]
    5 |     int minx=(1<<32)-1, miny=(1<<32)-1;
      |               ~^~~~
city.cpp:5:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    5 |     int minx=(1<<32)-1, miny=(1<<32)-1;
      |                               ~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...