#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define all(x) x.begin(), x.end()
#define kill(x) return cout << x << endl, 0
#define endl '\n'
constexpr ll pw(ll a, ll b, ll mod) {
return (!b ? 1 :
b & 1 ? a * pw(a * a % mod, b / 2, mod) % mod :
pw(a * a % mod, b / 2, mod));
}
constexpr int N = 1e5 + 10;
constexpr int MOD = 1e9;
ll ans;
int DistanceSum(int n, int *X, int *Y) {
sort(X, X + n);
sort(Y, Y + n);
for (int i = 1; i < n; i++) {
ans += (ll) i * (n - i) % MOD * (X[i] - X[i - 1]) % MOD;
ans += (ll) i * (n - i) % MOD * (Y[i] - Y[i - 1]) % MOD;
ans %= MOD;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
620 KB |
Output is correct |
2 |
Correct |
7 ms |
620 KB |
Output is correct |
3 |
Correct |
16 ms |
1132 KB |
Output is correct |
4 |
Correct |
16 ms |
1280 KB |
Output is correct |
5 |
Correct |
32 ms |
1900 KB |
Output is correct |
6 |
Correct |
30 ms |
1900 KB |
Output is correct |
7 |
Correct |
33 ms |
2028 KB |
Output is correct |
8 |
Correct |
32 ms |
1900 KB |
Output is correct |
9 |
Correct |
31 ms |
1900 KB |
Output is correct |
10 |
Correct |
30 ms |
1900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |