답안 #101564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101564 2019-03-19T04:30:24 Z ShaneOng 섬 항해 (CEOI13_adriatic) C++14
25 / 100
2000 ms 197216 KB
#include<bits/stdc++.h>
#define INF 100000009
using namespace std;
int adjMat[5009][5009],n,col[5009],row[5009];
int main(){
    scanf("%d",&n);
    for(int x=0,a,b;x<n;x++){
        scanf("%d%d",&a,&b);
        row[x]=a;
        col[x]=b;
        for(int y=0;y<x;y++){
            if(((row[x]>row[y])&&(col[x]>col[y]))||((row[x]<row[y])&&(col[x]<col[y]))){
                adjMat[x][y]=1;
                adjMat[y][x]=1;
            }else{
                adjMat[x][y]=INF;
                adjMat[y][x]=INF;
            }
        }
    }
    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 x=0;x<n;x++){
        int sum=0;
        for(int y=0;y<n;y++)
            sum+=adjMat[x][y];
        printf("%d\n",sum);
    }
}

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:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a,&b);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 768 KB Output is correct
2 Correct 5 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2033 ms 15232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 98428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 580 ms 197156 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 610 ms 197216 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -