Submission #101605

# Submission time Handle Problem Language Result Execution time Memory
101605 2019-03-19T05:05:18 Z SomeoneUnknown Adriatic (CEOI13_adriatic) C++14
25 / 100
2000 ms 263168 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ii mii(int b, int c){
    return make_pair(b,c);
}

int main(){
    int n;
    scanf("%d", &n);
    ii ilands[n];
    int dist[n][n];
    for(int i = 0; i < n; i++){
        int x, y;
        scanf("%d %d", &x, &y);
        ilands[i] = mii(x,y);
        for(int j = 0; j < i; j++){
            if((x > ilands[j].first && y > ilands[j].second) || (x < ilands[j].first && y < ilands[j].second)){
                dist[i][j] = dist[j][i] = 1;
            }else{
                dist[i][j] = dist[j][i] = n+5;
            }
        }
        dist[i][i] = 0;
    }
    for(int k = 0; k < n; k++)
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    for(int i = 0; i < n; i++){
        int tal = 0;
        for(int j = 0; j < n; j++){
            tal += dist[i][j];
        }
    printf("%d\n", tal);
    }
}

Compilation message

adriatic.cpp: In function 'int main()':
adriatic.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
adriatic.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2028 ms 9188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2047 ms 98240 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1200 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 4352 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -