답안 #943894

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943894 2024-03-12T04:02:20 Z vjudge1 Building Skyscrapers (CEOI19_skyscrapers) C++17
8 / 100
141 ms 13004 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,ind;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        mp[{x[i],y[i]}]=1;
        ind[{x[i],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;
    vector <int> ans;
    while(!q.empty()){
        int X=q.front().ff;
        int Y=q.front().ss;
        ans.pb(ind[{X,Y}]);
        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 : ans)cout<<x<<" ";
        cout<<"\n";
    }
    else cout<<"NO\n";
}
/*
 
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB ans=YES N=5
5 Correct 0 ms 348 KB ans=YES N=9
6 Correct 0 ms 344 KB ans=YES N=5
7 Correct 0 ms 348 KB ans=NO N=9
8 Correct 0 ms 348 KB ans=NO N=10
9 Correct 0 ms 348 KB ans=YES N=10
10 Correct 1 ms 344 KB ans=YES N=10
11 Correct 1 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 0 ms 348 KB ans=YES N=9
14 Correct 1 ms 344 KB ans=YES N=8
15 Correct 0 ms 344 KB ans=YES N=8
16 Correct 0 ms 344 KB ans=NO N=2
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB ans=YES N=5
5 Correct 0 ms 348 KB ans=YES N=9
6 Correct 0 ms 344 KB ans=YES N=5
7 Correct 0 ms 348 KB ans=NO N=9
8 Correct 0 ms 348 KB ans=NO N=10
9 Correct 0 ms 348 KB ans=YES N=10
10 Correct 1 ms 344 KB ans=YES N=10
11 Correct 1 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 0 ms 348 KB ans=YES N=9
14 Correct 1 ms 344 KB ans=YES N=8
15 Correct 0 ms 344 KB ans=YES N=8
16 Correct 0 ms 344 KB ans=NO N=2
17 Correct 0 ms 348 KB ans=YES N=17
18 Correct 0 ms 348 KB ans=YES N=25
19 Correct 0 ms 348 KB ans=YES N=100
20 Correct 1 ms 348 KB ans=YES N=185
21 Correct 0 ms 348 KB ans=NO N=174
22 Correct 1 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 1 ms 372 KB ans=YES N=87
25 Correct 1 ms 348 KB ans=YES N=183
26 Correct 1 ms 348 KB ans=YES N=188
27 Correct 1 ms 348 KB ans=YES N=183
28 Correct 1 ms 348 KB ans=YES N=189
29 Correct 1 ms 344 KB ans=YES N=200
30 Correct 1 ms 348 KB ans=YES N=190
31 Correct 1 ms 348 KB ans=YES N=187
32 Incorrect 1 ms 348 KB Added cell 73 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB ans=YES N=5
5 Correct 0 ms 348 KB ans=YES N=9
6 Correct 0 ms 344 KB ans=YES N=5
7 Correct 0 ms 348 KB ans=NO N=9
8 Correct 0 ms 348 KB ans=NO N=10
9 Correct 0 ms 348 KB ans=YES N=10
10 Correct 1 ms 344 KB ans=YES N=10
11 Correct 1 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 0 ms 348 KB ans=YES N=9
14 Correct 1 ms 344 KB ans=YES N=8
15 Correct 0 ms 344 KB ans=YES N=8
16 Correct 0 ms 344 KB ans=NO N=2
17 Correct 0 ms 348 KB ans=YES N=17
18 Correct 0 ms 348 KB ans=YES N=25
19 Correct 0 ms 348 KB ans=YES N=100
20 Correct 1 ms 348 KB ans=YES N=185
21 Correct 0 ms 348 KB ans=NO N=174
22 Correct 1 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 1 ms 372 KB ans=YES N=87
25 Correct 1 ms 348 KB ans=YES N=183
26 Correct 1 ms 348 KB ans=YES N=188
27 Correct 1 ms 348 KB ans=YES N=183
28 Correct 1 ms 348 KB ans=YES N=189
29 Correct 1 ms 344 KB ans=YES N=200
30 Correct 1 ms 348 KB ans=YES N=190
31 Correct 1 ms 348 KB ans=YES N=187
32 Incorrect 1 ms 348 KB Added cell 73 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB ans=NO N=1934
2 Correct 2 ms 604 KB ans=NO N=1965
3 Incorrect 4 ms 604 KB Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1049)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB ans=YES N=5
5 Correct 0 ms 348 KB ans=YES N=9
6 Correct 0 ms 344 KB ans=YES N=5
7 Correct 0 ms 348 KB ans=NO N=9
8 Correct 0 ms 348 KB ans=NO N=10
9 Correct 0 ms 348 KB ans=YES N=10
10 Correct 1 ms 344 KB ans=YES N=10
11 Correct 1 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 0 ms 348 KB ans=YES N=9
14 Correct 1 ms 344 KB ans=YES N=8
15 Correct 0 ms 344 KB ans=YES N=8
16 Correct 0 ms 344 KB ans=NO N=2
17 Correct 0 ms 348 KB ans=YES N=17
18 Correct 0 ms 348 KB ans=YES N=25
19 Correct 0 ms 348 KB ans=YES N=100
20 Correct 1 ms 348 KB ans=YES N=185
21 Correct 0 ms 348 KB ans=NO N=174
22 Correct 1 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 1 ms 372 KB ans=YES N=87
25 Correct 1 ms 348 KB ans=YES N=183
26 Correct 1 ms 348 KB ans=YES N=188
27 Correct 1 ms 348 KB ans=YES N=183
28 Correct 1 ms 348 KB ans=YES N=189
29 Correct 1 ms 344 KB ans=YES N=200
30 Correct 1 ms 348 KB ans=YES N=190
31 Correct 1 ms 348 KB ans=YES N=187
32 Incorrect 1 ms 348 KB Added cell 73 (136264791,-282023883) not reachable from infinity
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 13004 KB ans=NO N=66151
2 Correct 52 ms 9296 KB ans=NO N=64333
3 Incorrect 141 ms 11216 KB Contestant's solution is not lexicographically largest at index 69316 (69235 vs 7320)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB ans=NO N=1934
2 Correct 2 ms 604 KB ans=NO N=1965
3 Incorrect 4 ms 604 KB Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1049)
4 Halted 0 ms 0 KB -