Submission #315191

# Submission time Handle Problem Language Result Execution time Memory
315191 2020-10-22T04:21:54 Z juggernaut Ideal city (IOI12_city) C++14
32 / 100
175 ms 17280 KB
#include<bits/stdc++.h>
//#include"grader.cpp"
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;
}
/*
11
2 5
2 6
3 3
3 6
4 3
4 4
4 5
4 6
5 3
5 4
5 6
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 3 ms 1280 KB Output is correct
7 Correct 2 ms 1280 KB Output is correct
8 Correct 2 ms 1280 KB Output is correct
9 Correct 2 ms 1280 KB Output is correct
10 Correct 2 ms 1280 KB Output is correct
11 Correct 2 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 8192 KB Output is correct
2 Correct 41 ms 8312 KB Output is correct
3 Correct 90 ms 12288 KB Output is correct
4 Correct 97 ms 12160 KB Output is correct
5 Correct 163 ms 16256 KB Output is correct
6 Correct 175 ms 16264 KB Output is correct
7 Correct 160 ms 16120 KB Output is correct
8 Correct 169 ms 16120 KB Output is correct
9 Correct 168 ms 16248 KB Output is correct
10 Correct 162 ms 16120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 17280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 47 ms 17280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -