답안 #25629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25629 2017-06-23T09:11:49 Z Extazy 섬 항해 (CEOI13_adriatic) C++14
25 / 100
2000 ms 193480 KB
#include <bits/stdc++.h>

using namespace std;

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

int n,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],d[i][z]+d[z][j]);
                d[j][i]=min(d[j][i],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:14:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
adriatic.cpp:16: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);
                                                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 193480 KB Output is correct
2 Correct 3 ms 193480 KB Output is correct
3 Correct 0 ms 193480 KB Output is correct
4 Correct 0 ms 193480 KB Output is correct
5 Correct 0 ms 193480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2000 ms 193480 KB Execution timed out
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2000 ms 193480 KB Execution timed out
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 193480 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 73 ms 193480 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -