Submission #101526

# Submission time Handle Problem Language Result Execution time Memory
101526 2019-03-19T03:43:01 Z errorgorn Adriatic (CEOI13_adriatic) C++14
25 / 100
5 ms 384 KB
#include <cstdio>
#include <utility>
#include <cstring>
#include <algorithm>
using namespace std;
typedef pair<int,int> ii;
int n;
ii arr[105];
int asps[105][105];
void print(){
    for (int x=0;x<n;x++){
        for (int y=0;y<n;y++)
            printf("%d ",asps[x][y]);
        printf("\n");
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    memset(asps,63,sizeof(asps));
    int a,b;
    scanf("%d",&n);
    for (int x=0;x<n;x++){
        scanf("%d%d",&a,&b);
        arr[x]=ii(a,b);
    }
    for (int x=0;x<n;x++)
        for (int y=0;y<n;y++)
            if ((arr[x].first<arr[y].first && arr[x].second<arr[y].second)||(arr[x].first>arr[y].first && arr[x].second>arr[y].second)) asps[x][y]=1;
    for (int k=0;k<n;k++)
        for (int x=0;x<n;x++)
            for (int y=0;y<n;y++)
                asps[x][y]=min(asps[x][y],asps[x][k]+asps[k][y]);
    int _max;
    for (int x=0;x<n;x++){
        _max=0;
        for (int y=0;y<n;y++){
            if (x!=y) _max+=asps[x][y];
        }
        printf("%d\n",_max);
    }
}

Compilation message

adriatic.cpp: In function 'int main()':
adriatic.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
adriatic.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a,&b);
         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -