| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 413130 | A_D | 이상적인 도시 (IOI12_city) | C++14 | 12 ms | 1512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int MOD=1e9;
vector<LL> x,y;
vector<LL> prex,prey;
int DistanceSum(int N,int *X,int *Y){
x.clear();prex.clear();y.clear();prey.clear();
for(int i=0;i<N;i++){
x.push_back(X[i]);
y.push_back(Y[i]);
}
sort(x.begin(),x.end());
sort(y.begin(),y.end());
prex.push_back(x[0]);
prey.push_back(y[0]);
for(int i=1;i<N;i++){
prex.push_back(prex[i-1]+x[i]);
prey.push_back(prey[i-1]+y[i]);
}
LL ans=0;
for(int i=0;i<N;i++){
int l=0,r=N-1,ann;
while(l<=r){
int mid=(l+r)/2;
if(x[mid]<=X[i]){
ann=mid;
l=mid+1;
}
else r=mid-1;
}
ans+=X[i]*(ann+1)-prex[ann];
ans+=prex[N-1]-prex[ann]-(N-1-ann)*X[i];
l=0,r=N-1;
while(l<=r){
int mid=(l+r)/2;
if(y[mid]<=Y[i]){
ann=mid;
l=mid+1;
}
else r=mid-1;
}
ans+=Y[i]*(ann+1)-prey[ann];
ans+=prey[N-1]-prey[ann]-(N-1-ann)*Y[i];
ans%=MOD;
}
return ans/2;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
