# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
603772 | 2022-07-24T11:22:12 Z | Theo830 | Newspapers (CEOI21_newspapers) | C++17 | 1 ms | 724 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9+7; const ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training bool ok[1<<20] = {0}; bool v[1<<20] = {0}; vector<vll>adj; vll ans; bool solve(ll mask){ if(ok[mask]){ return 1; } if(v[mask]){ return 0; } v[mask] = 1; f(j,0,20){ if(mask & (1LL<<j)){ ll num = mask ^ (1LL<<j); ans.pb(j+1); ll neo = 0; f(i,0,20){ if(num & (1LL<<i)){ for(auto x:adj[i]){ neo |= (1<<x); } } } ok[mask] |= solve(neo); if(ok[mask]){ break; } ans.pop_back(); } } return ok[mask]; } int main(void){ ios_base::sync_with_stdio(0); cin.tie(0); ll n,m; cin>>n>>m; adj.assign(n+5,vll()); f(i,0,m){ ll a,b; cin>>a>>b; adj[a].pb(b); adj[b].pb(a); } ok[0] = 1; ll num = (1<<n) - 1; if(solve(num)){ cout<<"YES\n"; cout<<"1\n1\n"; } else{ cout<<"NO\n"; } }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
3 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
4 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
5 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
6 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
11 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
12 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
13 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
14 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
15 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
16 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
17 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
18 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
19 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
20 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
21 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
22 | Partially correct | 1 ms | 328 KB | Failed to provide a successful strategy. |
23 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
24 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
25 | Partially correct | 1 ms | 328 KB | Failed to provide a successful strategy. |
26 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
27 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
28 | Partially correct | 0 ms | 340 KB | Failed to provide a successful strategy. |
29 | Correct | 0 ms | 340 KB | Output is correct |
30 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
31 | Partially correct | 0 ms | 340 KB | Failed to provide a successful strategy. |
32 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
33 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
34 | Correct | 1 ms | 328 KB | Output is correct |
35 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
36 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
37 | Partially correct | 1 ms | 456 KB | Failed to provide a successful strategy. |
38 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
39 | Partially correct | 1 ms | 468 KB | Failed to provide a successful strategy. |
40 | Partially correct | 1 ms | 468 KB | Failed to provide a successful strategy. |
41 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
42 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
43 | Partially correct | 1 ms | 596 KB | Failed to provide a successful strategy. |
44 | Partially correct | 1 ms | 456 KB | Failed to provide a successful strategy. |
45 | Correct | 1 ms | 468 KB | Output is correct |
46 | Correct | 1 ms | 468 KB | Output is correct |
47 | Correct | 1 ms | 596 KB | Output is correct |
48 | Partially correct | 1 ms | 724 KB | Failed to provide a successful strategy. |
49 | Correct | 1 ms | 468 KB | Output is correct |
50 | Correct | 1 ms | 596 KB | Output is correct |
51 | Partially correct | 1 ms | 724 KB | Failed to provide a successful strategy. |
52 | Correct | 1 ms | 468 KB | Output is correct |
53 | Correct | 1 ms | 468 KB | Output is correct |
54 | Partially correct | 1 ms | 596 KB | Failed to provide a successful strategy. |
55 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
56 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
3 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
4 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
5 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
6 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
7 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
8 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
9 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
10 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
11 | Runtime error | 1 ms | 596 KB | Execution killed with signal 11 |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
3 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
4 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
5 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
6 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
11 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
12 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
13 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
14 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
15 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
16 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
17 | Partially correct | 1 ms | 212 KB | Failed to provide a successful strategy. |
18 | Partially correct | 0 ms | 212 KB | Failed to provide a successful strategy. |
19 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
20 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
21 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
22 | Partially correct | 1 ms | 328 KB | Failed to provide a successful strategy. |
23 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
24 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
25 | Partially correct | 1 ms | 328 KB | Failed to provide a successful strategy. |
26 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
27 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
28 | Partially correct | 0 ms | 340 KB | Failed to provide a successful strategy. |
29 | Correct | 0 ms | 340 KB | Output is correct |
30 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
31 | Partially correct | 0 ms | 340 KB | Failed to provide a successful strategy. |
32 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
33 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
34 | Correct | 1 ms | 328 KB | Output is correct |
35 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
36 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
37 | Partially correct | 1 ms | 456 KB | Failed to provide a successful strategy. |
38 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
39 | Partially correct | 1 ms | 468 KB | Failed to provide a successful strategy. |
40 | Partially correct | 1 ms | 468 KB | Failed to provide a successful strategy. |
41 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
42 | Partially correct | 1 ms | 340 KB | Failed to provide a successful strategy. |
43 | Partially correct | 1 ms | 596 KB | Failed to provide a successful strategy. |
44 | Partially correct | 1 ms | 456 KB | Failed to provide a successful strategy. |
45 | Correct | 1 ms | 468 KB | Output is correct |
46 | Correct | 1 ms | 468 KB | Output is correct |
47 | Correct | 1 ms | 596 KB | Output is correct |
48 | Partially correct | 1 ms | 724 KB | Failed to provide a successful strategy. |
49 | Correct | 1 ms | 468 KB | Output is correct |
50 | Correct | 1 ms | 596 KB | Output is correct |
51 | Partially correct | 1 ms | 724 KB | Failed to provide a successful strategy. |
52 | Correct | 1 ms | 468 KB | Output is correct |
53 | Correct | 1 ms | 468 KB | Output is correct |
54 | Partially correct | 1 ms | 596 KB | Failed to provide a successful strategy. |
55 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
56 | Halted | 0 ms | 0 KB | - |