#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
int mod=1e9+7;
const int N=2e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;
int n,t;
map<pair<int,int>,bool> mp;
map<pair<int,int>,int> plc;
vector<pair<int,int> > v;
vector<pair<int,int> > vv;
bool chk() {
bool bl=true;
sort(v.begin(),v.end());
for (int i=1;i<n;i++) {
if ((v[i].first-v[i-1].first)>1) {bl=false; break;}
}
sort(vv.begin(),vv.end());
for (int i=1;i<n;i++) {
if ((vv[i].first-vv[i-1].first)>1) {bl=false; break;}
}
return bl;
}
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(".in", "r", stdin); freopen(".out", "w", stdout);
cin>>n>>t;
for (int i=0;i<n;i++) {
int x,y; cin>>x>>y;
mp[{x,y}]=true;
plc[{x,y}]=i+1;
v.push_back({x,y});
vv.push_back({y,x});
}
vector<int> ans;
for (int i=0;i<n;i++) {
ans.push_back(plc[v[i]]);
}
bool bl=true;
for (int i=1;i<n;i++) {
int x=v[i].first,y=v[i].second;
if (mp[{x-1,y}] || mp[{x,y-1}] || mp[{x-1,y-1}] || mp[{x-1,y+1}]) continue;
bl=false;
}
if (!bl) {cout<<"NO"; return 0;}
cout<<"YES"<<endl;
for (int i:ans) {cout<<i<<endl;}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
1 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
1 ms |
212 KB |
ans=NO N=4 |
4 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
1 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
1 ms |
212 KB |
ans=NO N=4 |
4 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
1 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
1 ms |
212 KB |
ans=NO N=4 |
4 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1128 KB |
ans=NO N=1934 |
2 |
Correct |
3 ms |
724 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
596 KB |
Contestant did not find solution |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
1 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
1 ms |
212 KB |
ans=NO N=4 |
4 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
205 ms |
13036 KB |
ans=NO N=66151 |
2 |
Correct |
242 ms |
23780 KB |
ans=NO N=64333 |
3 |
Incorrect |
166 ms |
12792 KB |
Contestant did not find solution |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1128 KB |
ans=NO N=1934 |
2 |
Correct |
3 ms |
724 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
596 KB |
Contestant did not find solution |
4 |
Halted |
0 ms |
0 KB |
- |