#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>g[2005];
int d[2005][2005],res;
int DistanceSum(int n,int *X,int *Y){
int i,j;
for(i=0;i+1<n;i++)
for(j=i+1;j<n;j++){d[i][j]=2e9,d[j][i]=2e9;;if(abs(X[i]-X[j])+abs(Y[i]-Y[j])==1){
g[i].push_back(j);
g[j].push_back(i);
}}
for(i=0;i<n;i++){
queue<int>q;
q.push(i);
while(!q.empty()){
int v=q.front();
q.pop();
for(int to:g[v])if(d[i][to]>d[i][v]+1){
d[i][to]=d[i][v]+1;
q.push(to);
}
}
for(i=0;i+1<n;i++)
for(j=i+1;j<n;j++)res=(res+d[i][j])%(1000000000);
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
8320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
37 ms |
17408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
17440 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |