이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |