Submission #577574

#TimeUsernameProblemLanguageResultExecution timeMemory
577574amunduzbaevRoads (CEOI20_roads)C++17
15 / 100
22 ms2752 KiB
#include "bits/stdc++.h" using namespace std; #define ar array typedef int64_t ll; typedef long double ld; //~ #define int ll signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; vector<ar<int, 4>> a(n); for(int i=0;i<n;i++){ cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3]; if(a[i][0] > a[i][2]){ swap(a[i][0], a[i][2]), swap(a[i][1], a[i][3]); } if(a[i][0] == a[i][2] && a[i][1] > a[i][3]){ swap(a[i][0], a[i][2]), swap(a[i][1], a[i][3]); } //~ if(a[i][1] > a[i][3]) swap(a[i][0], a[i][2]), swap(a[i][1], a[i][3]); //~ if(a[i][1] == a[i][3]){ //~ if(a[i][0] > a[i][2]) swap(a[i][0], a[i][2]), swap(a[i][1], a[i][3]); //~ } } sort(a.begin(), a.end()); //~ , [&](auto& a, auto& b){ //~ if(a[1] != b[1]){ //~ return a[1] > b[1]; //~ } else { //~ return a[0] < b[0]; //~ } //~ }); map<ld, ar<int, 2>> mm; for(int i=0;i<n;i++){ ld p = a[i][0]; if(a[i][0] != a[i][2]){ p = 1. * (a[i][1] - a[i][3]) / 1. * (a[i][0] - a[i][2]); p = 1. * a[i][1] - p * a[i][0]; } if(mm.count(p)){ cout<<mm[p][0]<<" "<<mm[p][1]<<" "<<a[i][0]<<" "<<a[i][1]<<"\n"; } mm[p] = {a[i][2], a[i][3]}; } ar<int, 2> last {}; int c = 0; for(auto [d, p] : mm){ if(c){ cout<<last[0]<<" "<<last[1]<<" "<<p[0]<<" "<<p[1]<<"\n"; } last = p; c = 1; } }
#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...