Submission #447232

#TimeUsernameProblemLanguageResultExecution timeMemory
447232YahliRoads (CEOI20_roads)C++17
0 / 100
129 ms1840 KiB
#include <bits/stdc++.h> using namespace std; using pi = pair<int, int>; using ppi = pair<pi, pi>; int counter = 0; void process(vector<ppi> line){ for (int i = 1; i < line.size(); ++i){ cout << line[i-1].second.first << " " << line[i-1].second.second << " " << line[i].first.first << " " << line[i].first.second << endl; counter++; } } bool cmp(ppi f, ppi s){ if (f.first.second != s.first.second) return f.first.second < s.first.second; return f < s; } int main(){ int n; cin >> n; vector<ppi> data(n); for (int i = 0; i < n; ++i){ cin >> data[i].first.first >> data[i].first.second >> data[i].second.first >> data[i].second.second; if (data[i].first.first > data[i].second.first) swap(data[i].first, data[i].second); } sort(data.begin(), data.end(), cmp); vector<ppi> line; for (ppi now : data){ if (line.size() == 0 || line[0].first.second == now.first.second) line.push_back(now); else if (line.size() != 0){ cout << line[0].first.first << " " << line[0].first.second << " " << now.first.first << " " << now.first.second << endl; counter++; process(line); line = vector<ppi>(1, now); } else line.push_back(now); } process(line); if (counter != n-1) return -1; }

Compilation message (stderr)

roads.cpp: In function 'void process(std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >)':
roads.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 1; i < line.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...
#Verdict Execution timeMemoryGrader output
Fetching results...