Submission #791470

#TimeUsernameProblemLanguageResultExecution timeMemory
791470PoonYaPatRoads (CEOI20_roads)C++14
15 / 100
17 ms1876 KiB
#include <bits/stdc++.h> using namespace std; struct point { int x,y; }; typedef pair<point,point> ppp; vector<ppp> v; bool u; int n; bool comp(ppp A, ppp B) { point a=A.first, b=B.first; if (A.first.x==A.second.x) { if (a.x!=b.x) return a.x<b.x; else return a.y>b.y; } else if (A.first.y==A.second.y) { if (a.y!=b.y) return a.y<b.y; return a.x>b.x; } else if (u) { if (a.y-a.x!=b.y-b.x) return a.y-a.x<b.y-b.x; else return a.y>b.y; } else { if (a.x+a.y!=b.x+b.y) return a.x+a.y<b.x+b.y; else return a.y>b.y; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; for (int i=0; i<n; ++i) { point a,b; cin>>a.x>>a.y>>b.x>>b.y; if (a.y>b.y) swap(a,b); if (a.y==b.y && a.x>b.x) swap(a,b); v.push_back(ppp(a,b)); } if (v[0].first.x<v[0].second.x) u=true; sort(v.begin(),v.end(),comp); for (int i=1; i<v.size(); ++i) cout<<v[i-1].first.x<<" "<<v[i-1].first.y<<" "<<v[i].second.x<<" "<<v[i].second.y<<"\n"; }

Compilation message (stderr)

roads.cpp: In function 'int main()':
roads.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<point, point> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i=1; i<v.size(); ++i) cout<<v[i-1].first.x<<" "<<v[i-1].first.y<<" "<<v[i].second.x<<" "<<v[i].second.y<<"\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...
#Verdict Execution timeMemoryGrader output
Fetching results...