답안 #564656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
564656 2022-05-19T12:41:46 Z MrDeboo Building Skyscrapers (CEOI19_skyscrapers) C++17
0 / 100
48 ms 3560 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,t;
    cin>>n>>t;
    pair<int,int>pr[n];
    for(auto &i:pr)cin>>i.first>>i.second;
    pair<int,int>por[n];
    for(int i=0;i<n;i++)por[i]=pr[i];
    sort(pr,pr+n);
    vector<bool>vis(n);
    vis[0]=1;
    deque<pair<int,int>>dq={pr[0]};
    deque<pair<int,int>>g;
    int x[]={-1,0,1,1,1};
    int y[]={1,1,-1,1,0};
    while(dq.size()){
        pair<int,int>p=dq.front();
        dq.pop_front();
        g.push_back(p);
        for(int i=0;i<5;i++){
            pair<int,int>pp=make_pair(p.first+x[i],p.second+y[i]);
            int k=lower_bound(pr,pr+n,pp)-pr;
            if(k!=n&&pr[k]==pp&&!vis[k]){
                vis[k]=1;
                dq.push_back(pp);
            }
        }
    }
    if(g.size()!=n){cout<<"NO";}
    else{
        cout<<"YES\n";
        map<pair<int,int>,int>mp;
        for(int i=0;i<n;i++){
            mp[g[i]]=i+1;
        }
        for(int i=0;i<n;i++)cout<<mp[por[i]]<<endl;
    }
}

Compilation message

skyscrapers.cpp: In function 'int main()':
skyscrapers.cpp:37:16: warning: comparison of integer expressions of different signedness: 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   37 |     if(g.size()!=n){cout<<"NO";}
      |        ~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ans=YES N=1
2 Correct 0 ms 212 KB ans=YES N=4
3 Correct 1 ms 212 KB ans=NO N=4
4 Correct 0 ms 212 KB ans=YES N=5
5 Correct 0 ms 212 KB ans=YES N=9
6 Incorrect 0 ms 212 KB Added cell 5 (0,0) not reachable from infinity
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ans=YES N=1
2 Correct 0 ms 212 KB ans=YES N=4
3 Correct 1 ms 212 KB ans=NO N=4
4 Correct 0 ms 212 KB ans=YES N=5
5 Correct 0 ms 212 KB ans=YES N=9
6 Incorrect 0 ms 212 KB Added cell 5 (0,0) not reachable from infinity
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ans=YES N=1
2 Correct 0 ms 212 KB ans=YES N=4
3 Correct 1 ms 212 KB ans=NO N=4
4 Correct 0 ms 212 KB ans=YES N=5
5 Correct 0 ms 212 KB ans=YES N=9
6 Incorrect 0 ms 212 KB Added cell 5 (0,0) not reachable from infinity
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB ans=NO N=1934
2 Correct 1 ms 340 KB ans=NO N=1965
3 Incorrect 2 ms 340 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 0 ms 212 KB ans=YES N=4
3 Correct 1 ms 212 KB ans=NO N=4
4 Correct 0 ms 212 KB ans=YES N=5
5 Correct 0 ms 212 KB ans=YES N=9
6 Incorrect 0 ms 212 KB Added cell 5 (0,0) not reachable from infinity
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 3368 KB ans=NO N=66151
2 Correct 21 ms 2224 KB ans=NO N=64333
3 Incorrect 38 ms 3560 KB Contestant did not find solution
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB ans=NO N=1934
2 Correct 1 ms 340 KB ans=NO N=1965
3 Incorrect 2 ms 340 KB Contestant did not find solution
4 Halted 0 ms 0 KB -