Submission #767701

#TimeUsernameProblemLanguageResultExecution timeMemory
76770179brueAdriatic (CEOI13_adriatic)C++17
25 / 100
2072 ms262144 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct Point{ int x, y; Point(){} Point(int x, int y): x(x), y(y){} bool operator<(const Point &r)const{ return x<r.x; } }; int n; Point arr[250002]; vector<int> link[250002]; int dist[5002][5002]; bool visited[5002]; ll ans[250002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++){ scanf("%d %d", &arr[i].x, &arr[i].y); } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(i==j) continue; if((arr[i].x < arr[j].x && arr[i].y < arr[j].y) || (arr[i].x > arr[j].x && arr[i].y > arr[j].y)){ link[i].push_back(j); link[j].push_back(i); } } } for(int i=1; i<=n; i++){ memset(visited, 0, sizeof(visited)); queue<int> que; que.push(i); visited[i] = 1; while(!que.empty()){ int x = que.front(); que.pop(); for(auto y: link[x]){ if(visited[y]) continue; dist[i][y] = dist[i][x] + 1; visited[y] = 1; que.push(y); } } for(int j=1; j<=n; j++) ans[i] += dist[i][j]; printf("%lld\n", ans[i]); } }

Compilation message (stderr)

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