# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101441 | shenxy | Adriatic (CEOI13_adriatic) | C++11 | 2087 ms | 256652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |