Submission #576813

# Submission time Handle Problem Language Result Execution time Memory
576813 2022-06-13T14:49:34 Z temporary_juggernaut Newspapers (CEOI21_newspapers) C++14
9 / 100
390 ms 1236 KB
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
    #define printl(args...) printf(args)
#else
    #define printl(args...) 0
#endif
int a[20];
int n,m;
bool dp[1<<20];
pair<int,int>path[1<<20];
int main(){
	scanf("%d%d",&n,&m);
	while(m--){
		int x,y;
		scanf("%d%d",&x,&y);
		x--;y--;
		a[x]|=(1<<y);
		a[y]|=(1<<x);
	}
	int mx=(1<<n)-1;
	queue<int>q;
	q.push(mx);
	while(!q.empty()){
		int mask=q.front();
		q.pop();
		dp[mask]=true;
		for(int i=0;i<n;i++)if(mask>>i&1){
			int new_mask=0;
			for(int j=0;j<n;j++)if((mask>>j&1)&&(i^j))new_mask|=a[j];
			if(dp[new_mask])continue;
			path[new_mask]=make_pair(mask,i);
			q.push(new_mask);
		}
	}
	if(dp[0]){
		int cur_mask=0;
		vector<int>vec;
		while(cur_mask!=mx){
			vec.push_back(path[cur_mask].sc+1);
			cur_mask=path[cur_mask].fr;
		}
		reverse(vec.begin(),vec.end());
		puts("YES");
		printf("%d\n",(int)vec.size());
		for(int to:vec)printf("%d ",to);
	}else puts("NO");
}

Compilation message

newspapers.cpp: In function 'int main()':
newspapers.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
newspapers.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%d%d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
4 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
5 Correct 0 ms 212 KB Output is correct
6 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
7 Correct 0 ms 212 KB Output is correct
8 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
9 Correct 0 ms 212 KB Output is correct
10 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
11 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
12 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
13 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
14 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
15 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
16 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
17 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
18 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
19 Partially correct 1 ms 228 KB Provide a successful but not optimal strategy.
20 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
21 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
22 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
23 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
24 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
25 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
26 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
27 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
28 Partially correct 0 ms 340 KB Provide a successful but not optimal strategy.
29 Correct 0 ms 340 KB Output is correct
30 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
31 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
32 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
33 Partially correct 2 ms 340 KB Provide a successful but not optimal strategy.
34 Correct 0 ms 340 KB Output is correct
35 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
36 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
37 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
38 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
39 Partially correct 1 ms 640 KB Provide a successful but not optimal strategy.
40 Partially correct 3 ms 724 KB Provide a successful but not optimal strategy.
41 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
42 Partially correct 2 ms 596 KB Provide a successful but not optimal strategy.
43 Partially correct 1 ms 768 KB Provide a successful but not optimal strategy.
44 Partially correct 1 ms 596 KB Provide a successful but not optimal strategy.
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 468 KB Output is correct
47 Correct 2 ms 596 KB Output is correct
48 Partially correct 1 ms 1108 KB Provide a successful but not optimal strategy.
49 Correct 1 ms 468 KB Output is correct
50 Correct 1 ms 596 KB Output is correct
51 Partially correct 2 ms 980 KB Provide a successful but not optimal strategy.
52 Correct 1 ms 468 KB Output is correct
53 Correct 1 ms 596 KB Output is correct
54 Partially correct 1 ms 852 KB Provide a successful but not optimal strategy.
55 Correct 1 ms 724 KB Output is correct
56 Correct 1 ms 468 KB Output is correct
57 Correct 2 ms 1236 KB Output is correct
58 Correct 1 ms 704 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 0 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
6 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
7 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
8 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
9 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
10 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
11 Incorrect 390 ms 304 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
4 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
5 Correct 0 ms 212 KB Output is correct
6 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
7 Correct 0 ms 212 KB Output is correct
8 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
9 Correct 0 ms 212 KB Output is correct
10 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
11 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
12 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
13 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
14 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
15 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
16 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
17 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
18 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
19 Partially correct 1 ms 228 KB Provide a successful but not optimal strategy.
20 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
21 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
22 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
23 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
24 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
25 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
26 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
27 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
28 Partially correct 0 ms 340 KB Provide a successful but not optimal strategy.
29 Correct 0 ms 340 KB Output is correct
30 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
31 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
32 Partially correct 1 ms 340 KB Provide a successful but not optimal strategy.
33 Partially correct 2 ms 340 KB Provide a successful but not optimal strategy.
34 Correct 0 ms 340 KB Output is correct
35 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
36 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
37 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
38 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
39 Partially correct 1 ms 640 KB Provide a successful but not optimal strategy.
40 Partially correct 3 ms 724 KB Provide a successful but not optimal strategy.
41 Partially correct 1 ms 468 KB Provide a successful but not optimal strategy.
42 Partially correct 2 ms 596 KB Provide a successful but not optimal strategy.
43 Partially correct 1 ms 768 KB Provide a successful but not optimal strategy.
44 Partially correct 1 ms 596 KB Provide a successful but not optimal strategy.
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 468 KB Output is correct
47 Correct 2 ms 596 KB Output is correct
48 Partially correct 1 ms 1108 KB Provide a successful but not optimal strategy.
49 Correct 1 ms 468 KB Output is correct
50 Correct 1 ms 596 KB Output is correct
51 Partially correct 2 ms 980 KB Provide a successful but not optimal strategy.
52 Correct 1 ms 468 KB Output is correct
53 Correct 1 ms 596 KB Output is correct
54 Partially correct 1 ms 852 KB Provide a successful but not optimal strategy.
55 Correct 1 ms 724 KB Output is correct
56 Correct 1 ms 468 KB Output is correct
57 Correct 2 ms 1236 KB Output is correct
58 Correct 1 ms 704 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 0 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
68 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
69 Correct 0 ms 212 KB Output is correct
70 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
71 Correct 0 ms 212 KB Output is correct
72 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
73 Correct 0 ms 212 KB Output is correct
74 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
75 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
76 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
77 Partially correct 0 ms 212 KB Provide a successful but not optimal strategy.
78 Partially correct 1 ms 212 KB Provide a successful but not optimal strategy.
79 Runtime error 2 ms 340 KB Execution killed with signal 11
80 Halted 0 ms 0 KB -