제출 #429710

#제출 시각아이디문제언어결과실행 시간메모리
429710Mounir이상적인 도시 (IOI12_city)C++14
23 / 100
41 ms2932 KiB
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second #define pb push_back #define all(x) x.begin(), x.end() #define chmin(x, v) x = min(x, v) #define chmax(x, v) x = max(x, v) using namespace std; const int MOD = 1000000000, N = 3000; int delta[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; bool estVille[N][N], vue[N][N]; int dist[N][N]; int DistanceSum(int nVilles, int *X, int *Y) { vector<long long> x, y; for (int iVille = 0; iVille < nVilles; ++iVille){ x.pb(X[iVille]); y.pb(Y[iVille]); } sort(all(x)); sort(all(y)); long long SUM = 0; for (int i = 0; i < nVilles; ++i){ SUM = (SUM + 1LL * (x[i] * (2 * i - nVilles + 1)))%MOD; SUM = (SUM + 1LL * (y[i] * (2 * i - nVilles + 1)))%MOD; } return SUM%MOD; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...