#include<bits/stdc++.h>
using namespace std;
int mod=1e9;
int DistanceSum(int N, int *X, int *Y) {
sort(X,X+N);
sort(Y,Y+N);
long long ans=0;
for(long long i=0;i<N;i++){
ans+=i*X[i] - (N-i-1) *X[i];
ans%=mod;
}
for(long long i=0;i<N;i++){
ans+=i*Y[i] - (N-i-1) *Y[i];
ans%=mod;
}
return (ans+mod)%mod;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
600 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
9 ms |
1112 KB |
Output is correct |
4 |
Correct |
9 ms |
1116 KB |
Output is correct |
5 |
Correct |
18 ms |
1884 KB |
Output is correct |
6 |
Correct |
18 ms |
1884 KB |
Output is correct |
7 |
Correct |
20 ms |
2140 KB |
Output is correct |
8 |
Correct |
24 ms |
1840 KB |
Output is correct |
9 |
Correct |
18 ms |
1884 KB |
Output is correct |
10 |
Correct |
18 ms |
2052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |