Submission #533196

#TimeUsernameProblemLanguageResultExecution timeMemory
533196wenqiBuilding Skyscrapers (CEOI19_skyscrapers)C++17
0 / 100
72 ms6524 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<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(-i); }else{ P[(ll) x * M + y] = i; } } vector<int> R; while (not pq.empty()) { int i = -pq.top(); 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]) { pq.push(-P[idx]); 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:56:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   56 |     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...