Submission #101441

#TimeUsernameProblemLanguageResultExecution timeMemory
101441shenxyAdriatic (CEOI13_adriatic)C++11
25 / 100
2087 ms256652 KiB
#include <cstdio> #include <algorithm> using namespace std; int main() { int N; scanf("%d", &N); int R[N], C[N]; int adjmat[N][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; j < N; j++) { if (i == j) adjmat[i][j] = adjmat[j][i] = 0; else if ((R[i] < R[j] && C[i] < C[j]) || (R[i] > R[j] && C[i] > C[j])) adjmat[i][j] = adjmat[j][i] = 1; else adjmat[i][j] = adjmat[j][i] = 1000000; } } for (int k = 0; k < N; k++) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { adjmat[i][j] = min(adjmat[i][j], adjmat[i][k] + adjmat[k][j]); } } } for (int i = 0; i < N; i++) { int ans = 0; for (int j = 0; j < N; j++) { ans += adjmat[i][j]; } printf("%d\n", ans); } return 0; }

Compilation message (stderr)

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", &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...