Submission #101465

#TimeUsernameProblemLanguageResultExecution timeMemory
101465cheehengAdriatic (CEOI13_adriatic)C++14
25 / 100
2062 ms231916 KiB
#include <bits/stdc++.h> using namespace std; int R[250000]; int C[250000]; int dist[250000]; vector<int> AdjList[250005]; int main(){ int N; scanf("%d", &N); for(int i = 0; i < N; i ++){ scanf("%d%d", &R[i], &C[i]); } for(int i = 0; i < N; i ++){ for(int j = i+1; j < N; j ++){ if((R[i] < R[j] && C[i] < C[j]) || (R[i] > R[j] && C[i] > C[j])){ AdjList[i].push_back(j); AdjList[j].push_back(i); } } } for(int i = 0; i < N; i ++){ long long ans = 0; memset(dist, -1, sizeof(dist)); queue<int> q; q.push(i); dist[i] = 0; while(!q.empty()){ int u = q.front(); q.pop(); for(int v: AdjList[u]){ if(dist[v] == -1){ dist[v] = dist[u] + 1; q.push(v); } } } for(int j = 0; j < N; j ++){ ans += dist[j]; } printf("%lld\n", ans); } }

Compilation message (stderr)

adriatic.cpp: In function 'int main()':
adriatic.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
adriatic.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &R[i], &C[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...