Submission #101513

#TimeUsernameProblemLanguageResultExecution timeMemory
101513dwscAdriatic (CEOI13_adriatic)C++14
25 / 100
2045 ms263168 KiB
#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)

adriatic.cpp: In function 'int main()':
adriatic.cpp:12:44: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
             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)){
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:29:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 0; i < adj[u].size(); 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...