#include <bits/stdc++.h>
using namespace std;
int wx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, wy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
signed main(){
int n, t; cin >> n >> t;
vector<pair<int, int>> a(n);
for(int i = 0; i < n; ++i){
cin >> a[i].first >> a[i].second;
}
map<int, map<int, int>> mp;
vector<int> chk(n);
vector<int> ans;
for(int rep = 0; rep < n; ++rep){
pair<int, int> now = {(int)1e9, (int)1e9};
int pos = -1;
for(int i = 0; i < n; ++i){
if(chk[i]){
continue;
}
int cnt = 0;
for(int j = 0; j < 8; ++j){
cnt += mp[a[i].first + wx[j]][a[i].second + wy[j]];
if(cnt) break;
}
if(!cnt && rep) continue;
if(a[i] < now){
now = a[i];
pos = i;
}
}
if(now.first == (int)1e9){
cout << "NO\n";
return 0;
}
chk[pos] = 1;
ans.push_back(pos);
mp[a[pos].first][a[pos].second] = 1;
}
cout << "YES\n";
for(auto&i:ans){
cout << i + 1 << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1584 KB |
ans=NO N=1934 |
2 |
Correct |
107 ms |
572 KB |
ans=NO N=1965 |
3 |
Incorrect |
807 ms |
404 KB |
Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1702) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3591 ms |
5960 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1584 KB |
ans=NO N=1934 |
2 |
Correct |
107 ms |
572 KB |
ans=NO N=1965 |
3 |
Incorrect |
807 ms |
404 KB |
Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1702) |
4 |
Halted |
0 ms |
0 KB |
- |