Submission #761890

# Submission time Handle Problem Language Result Execution time Memory
761890 2023-06-20T11:01:09 Z Sohsoh84 Ideal city (IOI12_city) C++17
23 / 100
26 ms 1716 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define X		first
#define Y		second

const ll MAXN = 1e6 + 10;
const ll MOD = 1000000000;

int n;
vector<pll> vec;

int DistanceSum(int N, int *X, int *Y) {
	n = N;
	sort(X, X + n);
	sort(Y, Y + n);

	ll ps = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		ans = (ans + (1ll * i * X[i] - ps + MOD)) % MOD;
		ps = ps + X[i] % MOD;
	}

	ps = 0;
	for (int i = 0; i < n; i++) {
		ans = (ans + (1ll * i * Y[i] - ps + MOD)) % MOD;
		ps = ps + Y[i] % MOD;
	}

	return ans % MOD;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 560 KB Output is correct
2 Correct 4 ms 552 KB Output is correct
3 Correct 11 ms 1096 KB Output is correct
4 Correct 11 ms 1068 KB Output is correct
5 Correct 23 ms 1652 KB Output is correct
6 Correct 26 ms 1696 KB Output is correct
7 Correct 22 ms 1716 KB Output is correct
8 Correct 21 ms 1700 KB Output is correct
9 Correct 22 ms 1652 KB Output is correct
10 Correct 21 ms 1696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -