Submission #943893

#TimeUsernameProblemLanguageResultExecution timeMemory
943893vjudge1Building Skyscrapers (CEOI19_skyscrapers)C++17
0 / 100
116 ms7084 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define size(x) (int)x.size() template<class S, class T> bool chmin(S &a, const T &b) { return a > b ? (a = b) == b : false; } template<class S, class T> bool chmax(S &a, const T &b) { return a < b ? (a = b) == b : false; } const vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1}; const vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1}; signed main() { cin.tie(nullptr)->sync_with_stdio(false); int n, t; cin >> n >> t; int x[n], y[n]; map<int, map<int, bool>> used; map<int, vector<int>> g; for (int i = 0; i < n; ++i) { cin >> x[i] >> y[i]; used[x[i]][y[i]] = true; g[x[i] + y[i]].push_back(i); } for (int i = 0; i < n; ++i) { bool flag = false; for (int j = 0; j < 8; ++j) { if (used[x[i] + dx[j]][y[i] + dy[j]]) { flag |= true; } } if (!flag) { cout << "NO"; return 0; } } cout << "YES\n"; for (auto [k, v] : g) { sort(all(v), [&](const int& i, const int& j){ if (x[i] == x[j]) { return y[i] < y[j]; } return x[i] < x[j]; }); } for (auto [k, v] : g) { for (auto i : v) { cout << i + 1 << '\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...
#Verdict Execution timeMemoryGrader output
Fetching results...