답안 #1097488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097488 2024-10-07T13:15:49 Z alexander707070 Newspapers (CEOI21_newspapers) C++14
0 / 100
1000 ms 221520 KB
#include<bits/stdc++.h>
#define MAXN 200007
using namespace std;
 
int n,m,a,b;
vector<int> v[MAXN],to[1<<22];
bool li[1<<22];

bool dfs(int x,int y){
    if(x==y)return true;

    li[x]=true;
    for(int i:to[x]){
        if(!li[i] and dfs(i,y))return true;
    }

    return false;
}

int main(){

    cin>>n>>m;
    for(int i=1;i<=m;i++){
        cin>>a>>b;
        a--; b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    for(int i=0;i<(1<<n);i++){
        for(int f=0;f<n;f++){
            int res=0;

            for(int t=0;t<n;t++){
                if(((1<<t)&i)>0){
                    for(int s:v[t])res|=(1<<s);
                }
            }
            
            if((res&(1<<f))>0)res^=(1<<f);

            to[i].push_back(res);
        }
    }

    if(dfs((1<<n)-1,0)){
        cout<<"YES\n";
        cout<<"1\n1\n";
    }else{
        cout<<"NO\n";
    }
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 103504 KB Output is correct
2 Partially correct 52 ms 103812 KB Failed to provide a successful strategy.
3 Partially correct 43 ms 103512 KB Failed to provide a successful strategy.
4 Partially correct 43 ms 103460 KB Failed to provide a successful strategy.
5 Partially correct 44 ms 103508 KB Failed to provide a successful strategy.
6 Partially correct 43 ms 103504 KB Failed to provide a successful strategy.
7 Correct 43 ms 103512 KB Output is correct
8 Partially correct 44 ms 103760 KB Failed to provide a successful strategy.
9 Correct 43 ms 103508 KB Output is correct
10 Partially correct 43 ms 103512 KB Failed to provide a successful strategy.
11 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
12 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
13 Partially correct 43 ms 103504 KB Failed to provide a successful strategy.
14 Partially correct 43 ms 103608 KB Failed to provide a successful strategy.
15 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
16 Partially correct 48 ms 103508 KB Failed to provide a successful strategy.
17 Partially correct 48 ms 103556 KB Failed to provide a successful strategy.
18 Partially correct 49 ms 103508 KB Failed to provide a successful strategy.
19 Partially correct 49 ms 103760 KB Failed to provide a successful strategy.
20 Partially correct 51 ms 103760 KB Failed to provide a successful strategy.
21 Partially correct 56 ms 103748 KB Failed to provide a successful strategy.
22 Partially correct 53 ms 103632 KB Failed to provide a successful strategy.
23 Partially correct 53 ms 103760 KB Failed to provide a successful strategy.
24 Partially correct 52 ms 103764 KB Failed to provide a successful strategy.
25 Partially correct 55 ms 103948 KB Failed to provide a successful strategy.
26 Partially correct 55 ms 103760 KB Failed to provide a successful strategy.
27 Partially correct 60 ms 104024 KB Failed to provide a successful strategy.
28 Partially correct 57 ms 104184 KB Failed to provide a successful strategy.
29 Correct 58 ms 104020 KB Output is correct
30 Partially correct 56 ms 104276 KB Failed to provide a successful strategy.
31 Partially correct 64 ms 104816 KB Failed to provide a successful strategy.
32 Partially correct 63 ms 104784 KB Failed to provide a successful strategy.
33 Partially correct 63 ms 104784 KB Failed to provide a successful strategy.
34 Correct 66 ms 104792 KB Output is correct
35 Partially correct 80 ms 105996 KB Failed to provide a successful strategy.
36 Partially correct 79 ms 106068 KB Failed to provide a successful strategy.
37 Partially correct 84 ms 106068 KB Failed to provide a successful strategy.
38 Partially correct 76 ms 106064 KB Failed to provide a successful strategy.
39 Partially correct 109 ms 108624 KB Failed to provide a successful strategy.
40 Partially correct 109 ms 108716 KB Failed to provide a successful strategy.
41 Partially correct 109 ms 108624 KB Failed to provide a successful strategy.
42 Partially correct 112 ms 108812 KB Failed to provide a successful strategy.
43 Partially correct 188 ms 122192 KB Failed to provide a successful strategy.
44 Partially correct 185 ms 122220 KB Failed to provide a successful strategy.
45 Correct 189 ms 122192 KB Output is correct
46 Correct 193 ms 122096 KB Output is correct
47 Correct 354 ms 140624 KB Output is correct
48 Partially correct 353 ms 140736 KB Failed to provide a successful strategy.
49 Correct 337 ms 140568 KB Output is correct
50 Correct 347 ms 140624 KB Output is correct
51 Partially correct 644 ms 177744 KB Failed to provide a successful strategy.
52 Correct 679 ms 177744 KB Output is correct
53 Correct 652 ms 177760 KB Output is correct
54 Partially correct 665 ms 177964 KB Failed to provide a successful strategy.
55 Execution timed out 1052 ms 221520 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 103504 KB Output is correct
2 Partially correct 49 ms 103504 KB Failed to provide a successful strategy.
3 Partially correct 51 ms 103504 KB Failed to provide a successful strategy.
4 Partially correct 51 ms 103508 KB Failed to provide a successful strategy.
5 Partially correct 52 ms 103508 KB Failed to provide a successful strategy.
6 Partially correct 47 ms 103504 KB Failed to provide a successful strategy.
7 Partially correct 55 ms 103628 KB Failed to provide a successful strategy.
8 Partially correct 51 ms 103480 KB Failed to provide a successful strategy.
9 Partially correct 51 ms 103516 KB Failed to provide a successful strategy.
10 Partially correct 48 ms 103508 KB Failed to provide a successful strategy.
11 Execution timed out 1078 ms 110164 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 103504 KB Output is correct
2 Partially correct 52 ms 103812 KB Failed to provide a successful strategy.
3 Partially correct 43 ms 103512 KB Failed to provide a successful strategy.
4 Partially correct 43 ms 103460 KB Failed to provide a successful strategy.
5 Partially correct 44 ms 103508 KB Failed to provide a successful strategy.
6 Partially correct 43 ms 103504 KB Failed to provide a successful strategy.
7 Correct 43 ms 103512 KB Output is correct
8 Partially correct 44 ms 103760 KB Failed to provide a successful strategy.
9 Correct 43 ms 103508 KB Output is correct
10 Partially correct 43 ms 103512 KB Failed to provide a successful strategy.
11 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
12 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
13 Partially correct 43 ms 103504 KB Failed to provide a successful strategy.
14 Partially correct 43 ms 103608 KB Failed to provide a successful strategy.
15 Partially correct 43 ms 103508 KB Failed to provide a successful strategy.
16 Partially correct 48 ms 103508 KB Failed to provide a successful strategy.
17 Partially correct 48 ms 103556 KB Failed to provide a successful strategy.
18 Partially correct 49 ms 103508 KB Failed to provide a successful strategy.
19 Partially correct 49 ms 103760 KB Failed to provide a successful strategy.
20 Partially correct 51 ms 103760 KB Failed to provide a successful strategy.
21 Partially correct 56 ms 103748 KB Failed to provide a successful strategy.
22 Partially correct 53 ms 103632 KB Failed to provide a successful strategy.
23 Partially correct 53 ms 103760 KB Failed to provide a successful strategy.
24 Partially correct 52 ms 103764 KB Failed to provide a successful strategy.
25 Partially correct 55 ms 103948 KB Failed to provide a successful strategy.
26 Partially correct 55 ms 103760 KB Failed to provide a successful strategy.
27 Partially correct 60 ms 104024 KB Failed to provide a successful strategy.
28 Partially correct 57 ms 104184 KB Failed to provide a successful strategy.
29 Correct 58 ms 104020 KB Output is correct
30 Partially correct 56 ms 104276 KB Failed to provide a successful strategy.
31 Partially correct 64 ms 104816 KB Failed to provide a successful strategy.
32 Partially correct 63 ms 104784 KB Failed to provide a successful strategy.
33 Partially correct 63 ms 104784 KB Failed to provide a successful strategy.
34 Correct 66 ms 104792 KB Output is correct
35 Partially correct 80 ms 105996 KB Failed to provide a successful strategy.
36 Partially correct 79 ms 106068 KB Failed to provide a successful strategy.
37 Partially correct 84 ms 106068 KB Failed to provide a successful strategy.
38 Partially correct 76 ms 106064 KB Failed to provide a successful strategy.
39 Partially correct 109 ms 108624 KB Failed to provide a successful strategy.
40 Partially correct 109 ms 108716 KB Failed to provide a successful strategy.
41 Partially correct 109 ms 108624 KB Failed to provide a successful strategy.
42 Partially correct 112 ms 108812 KB Failed to provide a successful strategy.
43 Partially correct 188 ms 122192 KB Failed to provide a successful strategy.
44 Partially correct 185 ms 122220 KB Failed to provide a successful strategy.
45 Correct 189 ms 122192 KB Output is correct
46 Correct 193 ms 122096 KB Output is correct
47 Correct 354 ms 140624 KB Output is correct
48 Partially correct 353 ms 140736 KB Failed to provide a successful strategy.
49 Correct 337 ms 140568 KB Output is correct
50 Correct 347 ms 140624 KB Output is correct
51 Partially correct 644 ms 177744 KB Failed to provide a successful strategy.
52 Correct 679 ms 177744 KB Output is correct
53 Correct 652 ms 177760 KB Output is correct
54 Partially correct 665 ms 177964 KB Failed to provide a successful strategy.
55 Execution timed out 1052 ms 221520 KB Time limit exceeded
56 Halted 0 ms 0 KB -