Submission #1089027

#TimeUsernameProblemLanguageResultExecution timeMemory
1089027LilPlutonBuilding Skyscrapers (CEOI19_skyscrapers)C++14
0 / 100
25 ms5072 KiB
#include <bits/stdc++.h> using namespace std; #define int ll #define ll long long const int inf = 1e9 + 7; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; const int sz = 2e5 + 5; bool isadj(pair<int,int>& a, pair<int,int>& b){ int x1 = a.first; int x2 = b.first; int y1 = a.second; int y2 = b.second; if(x1 == x2){ return abs(y1 - y2) < 2; } if(y1 == y2){ return abs(x1 - x2) < 2; } int sum = abs(x1 - x2) + abs(y1 - y2); return sum <= 2; } signed main(){ int n, t; cin >> n >> t; vector<pair<int,int>> a(n); vector<pair<pair<int,int>, int>>v; for(int i = 0; i < n; ++i){ cin >> a[i].first >> a[i].second; v.push_back({{a[i].first, a[i].second}, i + 1}); } sort(begin(v), end(v)); bool ok = false; for(int i = 1; i < n; ++i){ if(!isadj(v[i].first, v[i - 1].first)){ ok = true; } } if(ok){ cout << "NO" << endl; }else{ cout << "YES" << endl; for(int i = 0; i < n; ++i){ cout << v[i].second << endl; } } }
#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...