Submission #943902

# Submission time Handle Problem Language Result Execution time Memory
943902 2024-03-12T04:13:33 Z vjudge1 Building Skyscrapers (CEOI19_skyscrapers) C++17
0 / 100
119 ms 9344 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,t;
    cin>>n>>t;
    vector <int> x(n),y(n);
    map <pair <int,int> ,int> mp;
    map <int,vector <pair <int,int> > > ind;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        mp[{x[i],y[i]}]=1;
        ind[x[i]].pb({y[i],i+1});
    }
    queue <pair <int,int> > q;
    vector <int> v={-1,1,0};
    q.push({x[0],y[0]});
    mp[{x[0],y[0]}]=2;
    while(!q.empty()){
        int X=q.front().ff;
        int Y=q.front().ss;
        q.pop();
        for(auto a : v){
            for(auto b : v){
                if(mp[{X+a,Y+b}]==1){
                    mp[{X+a,Y+b}]=2;
                    q.push({X+a,Y+b});
                }
            }
        }
    }
    bool ok=1;
    for(int i=0;i<n;i++){
        if(mp[{x[i],y[i]}]==1){
            ok=0;break;
        }
    }
    if(ok){
        cout<<"YES\n";
        for(auto x : ind){
            vector <pair <int,int> >  y=x.ss;
            sort(all(y));
            for(auto i : y)cout<<i.ss<<" ";
        }
    }
    else cout<<"NO\n";
}
/*
 
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ans=YES N=1
2 Correct 0 ms 348 KB ans=YES N=4
3 Correct 0 ms 348 KB ans=NO N=4
4 Incorrect 0 ms 348 KB Full cells must be connected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ans=YES N=1
2 Correct 0 ms 348 KB ans=YES N=4
3 Correct 0 ms 348 KB ans=NO N=4
4 Incorrect 0 ms 348 KB Full cells must be connected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ans=YES N=1
2 Correct 0 ms 348 KB ans=YES N=4
3 Correct 0 ms 348 KB ans=NO N=4
4 Incorrect 0 ms 348 KB Full cells must be connected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB ans=NO N=1934
2 Correct 1 ms 604 KB ans=NO N=1965
3 Incorrect 3 ms 600 KB Full cells must be connected
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ans=YES N=1
2 Correct 0 ms 348 KB ans=YES N=4
3 Correct 0 ms 348 KB ans=NO N=4
4 Incorrect 0 ms 348 KB Full cells must be connected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 107 ms 9344 KB ans=NO N=66151
2 Correct 46 ms 6992 KB ans=NO N=64333
3 Incorrect 119 ms 7916 KB Full cells must be connected
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB ans=NO N=1934
2 Correct 1 ms 604 KB ans=NO N=1965
3 Incorrect 3 ms 600 KB Full cells must be connected
4 Halted 0 ms 0 KB -