# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
533196 | wenqi | Building Skyscrapers (CEOI19_skyscrapers) | C++17 | 72 ms | 6524 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |