Submission #25630

# Submission time Handle Problem Language Result Execution time Memory
25630 2017-06-23T09:13:49 Z Extazy Adriatic (CEOI13_adriatic) C++14
25 / 100
2000 ms 97776 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 7000;
const int INF = (1e4) + 7;

int n;
short d[N][N];
pair < int, int > a[N];

int main() {
    int i,j,z;
    
    scanf("%d", &n);
    for(i=1;i<=n;i++) {
        scanf("%d %d", &a[i].first, &a[i].second);
    }

    for(i=1;i<=n;i++) {
        for(j=i+1;j<=n;j++) {
            if((a[i].first>a[j].first && a[i].second>a[j].second) || (a[i].first<a[j].first && a[i].second<a[j].second)) {
                d[i][j]=d[j][i]=1;
            }
        }
    }

    for(i=1;i<=n;i++) for(j=1;j<=n;j++) if(i!=j && d[i][j]==0) d[i][j]=INF;

    for(z=1;z<=n;z++) {
        for(i=1;i<=n;i++) {
            for(j=i+1;j<=n;j++) {
                d[i][j]=min(d[i][j],(short)(d[i][z]+d[z][j]));
                d[j][i]=min(d[j][i],(short)(d[j][z]+d[z][i]));
            }
        }
    }

    for(i=1;i<=n;i++) {
        long long sum=0;
        for(j=1;j<=n;j++) if(i!=j) sum+=d[i][j];
        printf("%lld\n", sum);
    }

    return 0;
}

Compilation message

adriatic.cpp: In function 'int main()':
adriatic.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
adriatic.cpp:17:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a[i].first, &a[i].second);
                                                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 97776 KB Output is correct
2 Correct 0 ms 97776 KB Output is correct
3 Correct 0 ms 97776 KB Output is correct
4 Correct 0 ms 97776 KB Output is correct
5 Correct 3 ms 97776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 97776 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 97776 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 97776 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 86 ms 97776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -