Submission #101441

# Submission time Handle Problem Language Result Execution time Memory
101441 2019-03-19T02:04:04 Z shenxy Adriatic (CEOI13_adriatic) C++11
25 / 100
2000 ms 256652 KB
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int N;
    scanf("%d", &N);
    int R[N], C[N];
    int adjmat[N][N];
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &R[i], &C[i]);
    }
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            if (i == j) adjmat[i][j] = adjmat[j][i] = 0;
            else if ((R[i] < R[j] && C[i] < C[j]) || (R[i] > R[j] && C[i] > C[j])) adjmat[i][j] = adjmat[j][i] = 1;
            else adjmat[i][j] = adjmat[j][i] = 1000000;
        }
    }
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                adjmat[i][j] = min(adjmat[i][j], adjmat[i][k] + adjmat[k][j]);
            }
        }
    }
    for (int i = 0; i < N; i++) {
        int ans = 0;
        for (int j = 0; j < N; j++) {
            ans += adjmat[i][j];
        }
        printf("%d\n", ans);
    }
    return 0;
}

Compilation message

adriatic.cpp: In function 'int main()':
adriatic.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
adriatic.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &R[i], &C[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2062 ms 9088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 98308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2087 ms 256652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -