Submission #101433

#TimeUsernameProblemLanguageResultExecution timeMemory
101433lyc섬 항해 (CEOI13_adriatic)C++14
25 / 100
2045 ms263168 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; #define fi first #define sc second #define SZ(x) (int)(x).size() #define ALL(x) (x).begin(), (x).end() int main() { //freopen("in.txt", "r", stdin); ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int x[n], y[n]; for (int i = 0; i < n; ++i) { cin >> x[i] >> y[i]; } int am[n][n]; memset(am, -1, sizeof am); for (int i = 0; i < n; ++i) am[i][i] = 0; for (int i = 0; i < n; ++i) { for (int j = i+1; j < n; ++j) { if ((x[i] < x[j] && y[i] < y[j]) || (x[j] < x[i] && y[j] < y[i])) am[i][j] = am[j][i] = 1; } } for (int k = 0; k < n; ++k) { for (int i = 0; i < n; ++i) if (am[i][k] != -1) { for (int j = 0; j < n; ++j) if (am[k][j] != -1) { if (am[i][j] == -1 || am[i][k] + am[k][j] < am[i][j]) am[i][j] = am[i][k]+am[k][j]; } } } for (int i = 0; i < n; ++i) { int ans = 0; for (int j = 0; j < n; ++j) ans += am[i][j]; cout << ans << '\n'; } }
#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...