Submission #533203

#TimeUsernameProblemLanguageResultExecution timeMemory
533203wenqiBuilding Skyscrapers (CEOI19_skyscrapers)C++17
22 / 100
72 ms6032 KiB
// trans rights #include <bits/stdc++.h> using namespace std; using ll = long long; #define M 1000000069 int N, T; int X[150069]; int Y[150069]; unordered_map<ll, int> P; int main(int argc, const char *argv[]) { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> T; priority_queue<pair<int, int>> pq; for (int i = 1; i <= N; i++) { int x, y; cin >> x >> y; X[i] = x; Y[i] = y; if (i == 1) { pq.push({0, i}); }else{ P[(ll) x * M + y] = i; } } vector<int> R; while (not pq.empty()) { int i = pq.top().second; pq.pop(); R.push_back(i); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { ll idx = (ll) (X[i] + x) * M + (Y[i] + y); if (P[idx]) { int j = P[idx]; pq.push({-max(abs(X[j] - X[1]), abs(Y[j] - Y[1])), j}); P[idx] = 0; } } } } if (R.size() != N) { cout << "NO\n"; }else{ cout << "YES\n"; for (int a : R) cout << a << '\n'; } return 0; }

Compilation message (stderr)

skyscrapers.cpp: In function 'int main(int, const char**)':
skyscrapers.cpp:57:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   57 |     if (R.size() != 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...