#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pb push_back
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n,t;
cin>>n>>t;
vector<pair<pair<ll,ll>,ll>>v;
map<pair<ll,ll>,ll>mp;
for(int i=0;i<n;i++)
{
ll x,y;
cin>>x>>y;
mp[{x,y}]=1;
v.push_back({{x,y},i+1});
}
bool m=true;
ll x[8]={1,1,1,-1,-1,-1,0,0},y[8]={1,-1,0,1,-1,0,1,-1};
ll lmt=1e9;
for(int i=0;i<n;i++)
{
ll f=v[i].first.first,s=v[i].first.second;
bool av=0;
for(int j=0;j<8;j++)
{
if(f+y[j]>lmt||s+x[j]>lmt)continue;
if(mp[{f+y[j],s+x[j]}]==1)
{
av=1;
break;
}
}
if(!av)
{
m=0;
break;
}
}
if(m)
{
sort(v.begin(),v.end());
cout<<"YES"<<endl;
for(int i=0;i<n;i++)cout<<v[i].second<<endl;
}
else cout<<"NO"<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
ans=NO N=1934 |
2 |
Correct |
2 ms |
468 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
460 KB |
Full cells must be connected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Contestant did not find solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
7388 KB |
ans=NO N=66151 |
2 |
Correct |
60 ms |
5760 KB |
ans=NO N=64333 |
3 |
Incorrect |
82 ms |
7580 KB |
Full cells must be connected |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
ans=NO N=1934 |
2 |
Correct |
2 ms |
468 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
460 KB |
Full cells must be connected |
4 |
Halted |
0 ms |
0 KB |
- |