Submission #101491

# Submission time Handle Problem Language Result Execution time Memory
101491 2019-03-19T03:15:59 Z dantoh000 Adriatic (CEOI13_adriatic) C++14
0 / 100
2000 ms 263168 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int main(){
    int n;
    scanf("%d",&n);
    vector<int> adjlist[n];
    vector<ii> co(n);
    for (int i = 0; i < n; i++){
        scanf("%d%d",&co[i].first,&co[i].second);
        for (int j = 0; j < i; j++){
            if (co[i].first < co[j].first && co[i].second < co[j].second){
                adjlist[i].push_back(j);
                adjlist[j].push_back(i);
            }
        }
    }
    int ans = 0;
    int dist[n];
    for (int i = 0; i < n; i++){
        ans = 0;
        memset(dist,-1,sizeof(dist));
        queue<int> q;
        dist[i] = 0; q.push(i);
        while (q.size()){
            int u = q.front(); q.pop();
            for (auto v : adjlist[u]){
                if (dist[v] == -1){
                    dist[v] = dist[u]+1;
                    ans += dist[v];
                    q.push(v);
                }
            }
        }
        printf("%d\n",ans);
    }

}

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:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&co[i].first,&co[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 790 ms 2872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 119720 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1901 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -