Submission #101605

#TimeUsernameProblemLanguageResultExecution timeMemory
101605SomeoneUnknownAdriatic (CEOI13_adriatic)C++14
25 / 100
2047 ms263168 KiB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ii mii(int b, int c){
    return make_pair(b,c);
}

int main(){
    int n;
    scanf("%d", &n);
    ii ilands[n];
    int dist[n][n];
    for(int i = 0; i < n; i++){
        int x, y;
        scanf("%d %d", &x, &y);
        ilands[i] = mii(x,y);
        for(int j = 0; j < i; j++){
            if((x > ilands[j].first && y > ilands[j].second) || (x < ilands[j].first && y < ilands[j].second)){
                dist[i][j] = dist[j][i] = 1;
            }else{
                dist[i][j] = dist[j][i] = n+5;
            }
        }
        dist[i][i] = 0;
    }
    for(int k = 0; k < n; k++)
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    for(int i = 0; i < n; i++){
        int tal = 0;
        for(int j = 0; j < n; j++){
            tal += dist[i][j];
        }
    printf("%d\n", tal);
    }
}

Compilation message (stderr)

adriatic.cpp: In function 'int main()':
adriatic.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
adriatic.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...