답안 #943920

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943920 2024-03-12T04:32:29 Z vjudge1 Building Skyscrapers (CEOI19_skyscrapers) C++17
8 / 100
154 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;
    }
    int X=mp.begin()->ff.ff;
    int Y=mp.begin()->ff.ss;
    queue <pair <int,int> > q;
    vector <int> v={-1,0,1};
    q.push({X,Y});
    mp[{X,Y}]=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 1 ms 600 KB ans=YES N=1
2 Correct 0 ms 344 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 348 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 1 ms 348 KB ans=YES N=10
10 Correct 0 ms 348 KB ans=YES N=10
11 Correct 0 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 1 ms 348 KB ans=YES N=9
14 Correct 0 ms 348 KB ans=YES N=8
15 Correct 0 ms 348 KB ans=YES N=8
16 Correct 0 ms 348 KB ans=NO N=2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB ans=YES N=1
2 Correct 0 ms 344 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 348 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 1 ms 348 KB ans=YES N=10
10 Correct 0 ms 348 KB ans=YES N=10
11 Correct 0 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 1 ms 348 KB ans=YES N=9
14 Correct 0 ms 348 KB ans=YES N=8
15 Correct 0 ms 348 KB ans=YES N=8
16 Correct 0 ms 348 KB ans=NO N=2
17 Correct 1 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 0 ms 348 KB ans=YES N=185
21 Correct 1 ms 348 KB ans=NO N=174
22 Correct 0 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 0 ms 348 KB ans=YES N=87
25 Correct 1 ms 344 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 344 KB ans=YES N=189
29 Correct 1 ms 348 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 Correct 1 ms 348 KB ans=YES N=187
33 Correct 1 ms 348 KB ans=YES N=182
34 Correct 1 ms 348 KB ans=YES N=184
35 Correct 1 ms 348 KB ans=YES N=188
36 Correct 1 ms 344 KB ans=YES N=181
37 Correct 1 ms 348 KB ans=YES N=188
38 Correct 1 ms 560 KB ans=YES N=191
39 Incorrect 1 ms 348 KB Added cell 196 (16,2) not reachable from infinity
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB ans=YES N=1
2 Correct 0 ms 344 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 348 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 1 ms 348 KB ans=YES N=10
10 Correct 0 ms 348 KB ans=YES N=10
11 Correct 0 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 1 ms 348 KB ans=YES N=9
14 Correct 0 ms 348 KB ans=YES N=8
15 Correct 0 ms 348 KB ans=YES N=8
16 Correct 0 ms 348 KB ans=NO N=2
17 Correct 1 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 0 ms 348 KB ans=YES N=185
21 Correct 1 ms 348 KB ans=NO N=174
22 Correct 0 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 0 ms 348 KB ans=YES N=87
25 Correct 1 ms 344 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 344 KB ans=YES N=189
29 Correct 1 ms 348 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 Correct 1 ms 348 KB ans=YES N=187
33 Correct 1 ms 348 KB ans=YES N=182
34 Correct 1 ms 348 KB ans=YES N=184
35 Correct 1 ms 348 KB ans=YES N=188
36 Correct 1 ms 344 KB ans=YES N=181
37 Correct 1 ms 348 KB ans=YES N=188
38 Correct 1 ms 560 KB ans=YES N=191
39 Incorrect 1 ms 348 KB Added cell 196 (16,2) not reachable from infinity
40 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 3 ms 604 KB Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1702)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB ans=YES N=1
2 Correct 0 ms 344 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 348 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 1 ms 348 KB ans=YES N=10
10 Correct 0 ms 348 KB ans=YES N=10
11 Correct 0 ms 348 KB ans=YES N=10
12 Correct 0 ms 348 KB ans=YES N=9
13 Correct 1 ms 348 KB ans=YES N=9
14 Correct 0 ms 348 KB ans=YES N=8
15 Correct 0 ms 348 KB ans=YES N=8
16 Correct 0 ms 348 KB ans=NO N=2
17 Correct 1 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 0 ms 348 KB ans=YES N=185
21 Correct 1 ms 348 KB ans=NO N=174
22 Correct 0 ms 348 KB ans=YES N=90
23 Correct 0 ms 348 KB ans=YES N=63
24 Correct 0 ms 348 KB ans=YES N=87
25 Correct 1 ms 344 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 344 KB ans=YES N=189
29 Correct 1 ms 348 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 Correct 1 ms 348 KB ans=YES N=187
33 Correct 1 ms 348 KB ans=YES N=182
34 Correct 1 ms 348 KB ans=YES N=184
35 Correct 1 ms 348 KB ans=YES N=188
36 Correct 1 ms 344 KB ans=YES N=181
37 Correct 1 ms 348 KB ans=YES N=188
38 Correct 1 ms 560 KB ans=YES N=191
39 Incorrect 1 ms 348 KB Added cell 196 (16,2) not reachable from infinity
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 13004 KB ans=NO N=66151
2 Correct 51 ms 9240 KB ans=NO N=64333
3 Incorrect 154 ms 11300 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 3 ms 604 KB Contestant's solution is not lexicographically largest at index 1824 (1813 vs 1702)
4 Halted 0 ms 0 KB -