Submission #757953

#TimeUsernameProblemLanguageResultExecution timeMemory
757953DexvaTowers (NOI22_towers)C++14
5 / 100
654 ms53344 KiB
#include <bits/stdc++.h> using namespace std; #define lln long long void solve() { lln n; cin >> n; vector< pair<lln, lln> > points; set<lln> xs, ys; for (lln i=0;i<n;i++) { lln x, y; cin >> x >> y; xs.insert(x); ys.insert(y); points.push_back(make_pair(x,y)); } string ans = "1"; if (n==1) { ans = "1"; } else if (n==2) { ans = "11"; } else if (n==3) { // cout << xs.size() << " " << ys.size() << '\n'; if (xs.size()==1 && ys.size()==3) { lln maxy = 0, miny = 0; for (lln i=0;i<n;i++) { if (get<1>(points[maxy]) < get<1>(points[i])) maxy = i; if (get<1>(points[miny]) > get<1>(points[i])) miny = i; } ans = ""; for (lln i=0;i<n;i++) { if (i==maxy || i==miny) ans += "1"; else ans += "0"; } } else if (xs.size()==3 && ys.size()==1) { lln maxx = 0, minx = 0; for (lln i=0;i<n;i++) { if (get<0>(points[maxx]) < get<0>(points[i])) maxx = i; if (get<0>(points[minx]) > get<0>(points[i])) minx = i; } ans = ""; for (lln i=0;i<n;i++) { if (i==maxx || i==minx) ans += "1"; else ans += "0"; } } else ans = "111"; } else ans = "1"; cout << ans << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; while (t--) solve(); return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...