# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101513 | dwsc | Adriatic (CEOI13_adriatic) | C++14 | 2045 ms | 263168 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 <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int main(){
int n;
cin >> n;
ii arr[n];
vector<int> adj[n];
for (int i = 0; i < n; i++){
cin >> arr[i].first >> arr[i].second;
for (int j = 0; j < i; j++){
if ((arr[j].first<arr[i].first)&&(arr[j].second<arr[i].second)||(arr[j].first>arr[i].first)&&(arr[j].second>arr[i].second)){
adj[j].push_back(i);
adj[i].push_back(j);
// cout<< i << " " << j << "hi\n";
}
}
}
for (int i = 0; i < n; i++){
queue<int> q;
q.push(i);
int dist[n];
memset(dist,-1,sizeof(dist));
dist[i] = 0;
int sum = 0;
while (!q.empty()){
int u = q.front();
q.pop();
for (int i = 0; i < adj[u].size(); i++){
int v = adj[u][i];
if (dist[v] == -1){
dist[v] = dist[u]+1;
sum += dist[v];
q.push(v);
}
}
}
cout << sum << "\n";
}
}
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... |