#include "Alicelib.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bugz
void Alice( int n, int m, int a[], int b[] ){
int arr[10][10]={
{0,0,0,0,0,0,0,0,1,0},
{0,0,1,0,0,0,1,0,0,0},
{0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,0,1,1,1},
{0,0,0,0,0,0,0,0,1,1},
{0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,0}
};
vector<int> id;
int val[1024];
rep(x,0,1024) if (__builtin_popcount(x)<9) id.pub(x);
rep(x,0,sz(id)) val[id[x]]=x;
vector<ii> v;
rep(x,0,10) rep(y,0,10) if (arr[x][y]) v.pub({n+x,n+y});
rep(x,0,n+10) v.pub({n+10,x});
rep(x,0,n) v.pub({n+11,x});
rep(x,0,m) v.pub({a[x],b[x]});
rep(x,0,n){
rep(y,0,10) if (id[x]&(1<<y)) v.pub({x,n+y});
}
InitG(n+12,sz(v));
rep(x,0,sz(v)) MakeG(x,v[x].fi,v[x].se);
}
#include "Boblib.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug
bool grid[1030][1030];
int ord[1030];
void Bob( int n, int m, int c[], int d[] ){
int arr[10][10]={
{0,0,0,0,0,0,0,0,1,0},
{0,0,1,0,0,0,1,0,0,0},
{0,0,0,1,0,0,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,0,0,1,1,1},
{0,0,0,0,0,0,0,0,1,1},
{0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,0}
};
vector<int> id;
int val[1024];
rep(x,0,1024) if (__builtin_popcount(x)<9) id.pub(x);
rep(x,0,sz(id)) val[id[x]]=x;
rep(x,0,m){
grid[c[x]][d[x]]=true;
grid[d[x]][c[x]]=true;
}
int idx=-1;
int mx=0;
rep(x,0,n){
int deg=0;
rep(y,0,n) if (grid[x][y]) deg++;
if (deg>mx){
mx=deg;
idx=x;
}
}
//cout<<mx<<" "<<idx<<endl;
int idx2;
rep(x,0,n) if (x!=idx && !grid[idx][x]) idx2=x;
//cout<<idx2<<endl;
vector<int> ids;
rep(x,0,n) if (x!=idx2 && x!=idx && !grid[idx2][x]) ids.pub(x);
sort(all(ids));
//for (auto &it:ids) cout<<it<<" "; cout<<endl;
do{
bool can=true;
rep(x,0,10) rep(y,x+1,10){
if (arr[x][y]!=grid[ids[x]][ids[y]]){
can=false;
goto end;
}
}
end:;
if (can) break;
} while (next_permutation(all(ids)));
//for (auto &it:ids) cout<<it<<" "; cout<<endl;
rep(x,0,n) if (x!=idx && x!=idx2){
bool can=true;
rep(y,0,sz(ids)) if (x==ids[y]) can=false;
if (can){
int num=0;
rep(y,0,10) if (grid[x][ids[y]]) num|=(1<<y);
ord[num]=x;
}
}
vector<ii> ans;
rep(x,0,n-12) rep(y,x+1,n-12){
if (grid[ord[val[x]]][ord[val[y]]]) ans.pub({x,y});
}
InitMap(n-12,sz(ans));
for (auto &it:ans) MakeMap(it.fi,it.se);
}
Compilation message
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:46:6: warning: variable 'val' set but not used [-Wunused-but-set-variable]
46 | int val[1024];
| ^~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:98:28: warning: 'idx2' may be used uninitialized in this function [-Wmaybe-uninitialized]
98 | rep(x,0,n) if (x!=idx && x!=idx2){
| ~^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
4580 KB |
Output is correct |
2 |
Correct |
15 ms |
4580 KB |
Output is correct |
3 |
Correct |
17 ms |
4664 KB |
Output is correct |
4 |
Correct |
32 ms |
4576 KB |
Output is correct |
5 |
Correct |
16 ms |
4516 KB |
Output is correct |
6 |
Correct |
19 ms |
4616 KB |
Output is correct |
7 |
Correct |
18 ms |
4612 KB |
Output is correct |
8 |
Correct |
27 ms |
4580 KB |
Output is correct |
9 |
Correct |
4 ms |
4588 KB |
Output is correct |
10 |
Correct |
12 ms |
4584 KB |
Output is correct |
11 |
Correct |
16 ms |
4684 KB |
Output is correct |
12 |
Correct |
28 ms |
4516 KB |
Output is correct |
13 |
Correct |
16 ms |
4588 KB |
Output is correct |
14 |
Correct |
24 ms |
4592 KB |
Output is correct |
15 |
Correct |
13 ms |
4568 KB |
Output is correct |
16 |
Correct |
20 ms |
4584 KB |
Output is correct |
17 |
Correct |
27 ms |
4528 KB |
Output is correct |
18 |
Correct |
33 ms |
4568 KB |
Output is correct |
19 |
Correct |
30 ms |
4592 KB |
Output is correct |
20 |
Correct |
22 ms |
4588 KB |
Output is correct |
21 |
Correct |
17 ms |
4588 KB |
Output is correct |
22 |
Correct |
20 ms |
4584 KB |
Output is correct |
23 |
Correct |
20 ms |
4568 KB |
Output is correct |
24 |
Correct |
20 ms |
4584 KB |
Output is correct |
25 |
Correct |
22 ms |
4596 KB |
Output is correct |
26 |
Correct |
26 ms |
4596 KB |
Output is correct |
27 |
Correct |
13 ms |
4588 KB |
Output is correct |
28 |
Correct |
13 ms |
4624 KB |
Output is correct |
29 |
Correct |
17 ms |
4588 KB |
Output is correct |
30 |
Correct |
32 ms |
4564 KB |
Output is correct |
31 |
Correct |
10 ms |
4584 KB |
Output is correct |
32 |
Correct |
9 ms |
4680 KB |
Output is correct |
33 |
Correct |
22 ms |
4580 KB |
Output is correct |
34 |
Correct |
20 ms |
4588 KB |
Output is correct |
35 |
Correct |
35 ms |
4576 KB |
Output is correct |
36 |
Correct |
7 ms |
4588 KB |
Output is correct |
37 |
Correct |
13 ms |
4588 KB |
Output is correct |
38 |
Correct |
30 ms |
4584 KB |
Output is correct |
39 |
Correct |
18 ms |
4628 KB |
Output is correct |
40 |
Correct |
11 ms |
4568 KB |
Output is correct |
41 |
Correct |
9 ms |
4540 KB |
Output is correct |
42 |
Correct |
19 ms |
4588 KB |
Output is correct |
43 |
Correct |
31 ms |
4588 KB |
Output is correct |
44 |
Correct |
20 ms |
4584 KB |
Output is correct |
45 |
Correct |
19 ms |
4528 KB |
Output is correct |
46 |
Correct |
11 ms |
4584 KB |
Output is correct |
47 |
Correct |
30 ms |
4600 KB |
Output is correct |
48 |
Correct |
12 ms |
4588 KB |
Output is correct |
49 |
Correct |
18 ms |
4564 KB |
Output is correct |
50 |
Correct |
4 ms |
4584 KB |
Output is correct |
51 |
Correct |
19 ms |
4612 KB |
Output is correct |
52 |
Correct |
22 ms |
4588 KB |
Output is correct |
53 |
Correct |
33 ms |
4596 KB |
Output is correct |
54 |
Correct |
14 ms |
4596 KB |
Output is correct |
55 |
Correct |
18 ms |
4672 KB |
Output is correct |
56 |
Correct |
9 ms |
4588 KB |
Output is correct |
57 |
Correct |
27 ms |
4620 KB |
Output is correct |
58 |
Correct |
15 ms |
4600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
4580 KB |
Output is correct |
2 |
Correct |
15 ms |
4580 KB |
Output is correct |
3 |
Correct |
17 ms |
4664 KB |
Output is correct |
4 |
Correct |
32 ms |
4576 KB |
Output is correct |
5 |
Correct |
16 ms |
4516 KB |
Output is correct |
6 |
Correct |
19 ms |
4616 KB |
Output is correct |
7 |
Correct |
18 ms |
4612 KB |
Output is correct |
8 |
Correct |
27 ms |
4580 KB |
Output is correct |
9 |
Correct |
4 ms |
4588 KB |
Output is correct |
10 |
Correct |
12 ms |
4584 KB |
Output is correct |
11 |
Correct |
16 ms |
4684 KB |
Output is correct |
12 |
Correct |
28 ms |
4516 KB |
Output is correct |
13 |
Correct |
16 ms |
4588 KB |
Output is correct |
14 |
Correct |
24 ms |
4592 KB |
Output is correct |
15 |
Correct |
13 ms |
4568 KB |
Output is correct |
16 |
Correct |
20 ms |
4584 KB |
Output is correct |
17 |
Correct |
27 ms |
4528 KB |
Output is correct |
18 |
Correct |
33 ms |
4568 KB |
Output is correct |
19 |
Correct |
30 ms |
4592 KB |
Output is correct |
20 |
Correct |
22 ms |
4588 KB |
Output is correct |
21 |
Correct |
17 ms |
4588 KB |
Output is correct |
22 |
Correct |
20 ms |
4584 KB |
Output is correct |
23 |
Correct |
20 ms |
4568 KB |
Output is correct |
24 |
Correct |
20 ms |
4584 KB |
Output is correct |
25 |
Correct |
22 ms |
4596 KB |
Output is correct |
26 |
Correct |
26 ms |
4596 KB |
Output is correct |
27 |
Correct |
13 ms |
4588 KB |
Output is correct |
28 |
Correct |
13 ms |
4624 KB |
Output is correct |
29 |
Correct |
17 ms |
4588 KB |
Output is correct |
30 |
Correct |
32 ms |
4564 KB |
Output is correct |
31 |
Correct |
10 ms |
4584 KB |
Output is correct |
32 |
Correct |
9 ms |
4680 KB |
Output is correct |
33 |
Correct |
22 ms |
4580 KB |
Output is correct |
34 |
Correct |
20 ms |
4588 KB |
Output is correct |
35 |
Correct |
35 ms |
4576 KB |
Output is correct |
36 |
Correct |
7 ms |
4588 KB |
Output is correct |
37 |
Correct |
13 ms |
4588 KB |
Output is correct |
38 |
Correct |
30 ms |
4584 KB |
Output is correct |
39 |
Correct |
18 ms |
4628 KB |
Output is correct |
40 |
Correct |
11 ms |
4568 KB |
Output is correct |
41 |
Correct |
9 ms |
4540 KB |
Output is correct |
42 |
Correct |
19 ms |
4588 KB |
Output is correct |
43 |
Correct |
31 ms |
4588 KB |
Output is correct |
44 |
Correct |
20 ms |
4584 KB |
Output is correct |
45 |
Correct |
19 ms |
4528 KB |
Output is correct |
46 |
Correct |
11 ms |
4584 KB |
Output is correct |
47 |
Correct |
30 ms |
4600 KB |
Output is correct |
48 |
Correct |
12 ms |
4588 KB |
Output is correct |
49 |
Correct |
18 ms |
4564 KB |
Output is correct |
50 |
Correct |
4 ms |
4584 KB |
Output is correct |
51 |
Correct |
19 ms |
4612 KB |
Output is correct |
52 |
Correct |
22 ms |
4588 KB |
Output is correct |
53 |
Correct |
33 ms |
4596 KB |
Output is correct |
54 |
Correct |
14 ms |
4596 KB |
Output is correct |
55 |
Correct |
18 ms |
4672 KB |
Output is correct |
56 |
Correct |
9 ms |
4588 KB |
Output is correct |
57 |
Correct |
27 ms |
4620 KB |
Output is correct |
58 |
Correct |
15 ms |
4600 KB |
Output is correct |
59 |
Correct |
25 ms |
4772 KB |
Output is correct |
60 |
Correct |
23 ms |
4824 KB |
Output is correct |
61 |
Correct |
22 ms |
4632 KB |
Output is correct |
62 |
Correct |
30 ms |
4644 KB |
Output is correct |
63 |
Correct |
13 ms |
4584 KB |
Output is correct |
64 |
Correct |
16 ms |
4844 KB |
Output is correct |
65 |
Correct |
36 ms |
4852 KB |
Output is correct |
66 |
Correct |
28 ms |
4844 KB |
Output is correct |
67 |
Correct |
9 ms |
4844 KB |
Output is correct |
68 |
Correct |
17 ms |
4668 KB |
Output is correct |
69 |
Correct |
19 ms |
4752 KB |
Output is correct |
70 |
Correct |
32 ms |
4840 KB |
Output is correct |
71 |
Correct |
5 ms |
4844 KB |
Output is correct |
72 |
Correct |
12 ms |
4832 KB |
Output is correct |
73 |
Correct |
22 ms |
4840 KB |
Output is correct |
74 |
Correct |
11 ms |
4696 KB |
Output is correct |
75 |
Correct |
16 ms |
4648 KB |
Output is correct |
76 |
Correct |
30 ms |
4756 KB |
Output is correct |
77 |
Correct |
7 ms |
4856 KB |
Output is correct |
78 |
Correct |
28 ms |
4844 KB |
Output is correct |
79 |
Correct |
20 ms |
4752 KB |
Output is correct |
80 |
Correct |
15 ms |
4760 KB |
Output is correct |
81 |
Correct |
24 ms |
4768 KB |
Output is correct |
82 |
Correct |
9 ms |
4588 KB |
Output is correct |
83 |
Correct |
15 ms |
4832 KB |
Output is correct |
84 |
Correct |
11 ms |
4824 KB |
Output is correct |
85 |
Correct |
7 ms |
4796 KB |
Output is correct |
86 |
Correct |
27 ms |
4760 KB |
Output is correct |
87 |
Correct |
25 ms |
4728 KB |
Output is correct |
88 |
Correct |
22 ms |
4656 KB |
Output is correct |
89 |
Correct |
15 ms |
4692 KB |
Output is correct |
90 |
Correct |
13 ms |
4636 KB |
Output is correct |
91 |
Correct |
20 ms |
4708 KB |
Output is correct |
92 |
Correct |
7 ms |
4596 KB |
Output is correct |
93 |
Correct |
34 ms |
4624 KB |
Output is correct |
94 |
Correct |
43 ms |
4972 KB |
Output is correct |
95 |
Correct |
28 ms |
4784 KB |
Output is correct |
96 |
Correct |
25 ms |
4852 KB |
Output is correct |
97 |
Correct |
15 ms |
4852 KB |
Output is correct |
98 |
Correct |
7 ms |
4848 KB |
Output is correct |
99 |
Correct |
9 ms |
4752 KB |
Output is correct |
100 |
Correct |
13 ms |
4784 KB |
Output is correct |
101 |
Correct |
22 ms |
4516 KB |
Output is correct |
102 |
Correct |
7 ms |
4712 KB |
Output is correct |
103 |
Correct |
33 ms |
4624 KB |
Output is correct |
104 |
Correct |
15 ms |
4784 KB |
Output is correct |
105 |
Correct |
20 ms |
4844 KB |
Output is correct |
106 |
Correct |
6 ms |
4824 KB |
Output is correct |
107 |
Correct |
22 ms |
4624 KB |
Output is correct |
108 |
Correct |
5 ms |
4644 KB |
Output is correct |
109 |
Correct |
38 ms |
4760 KB |
Output is correct |
110 |
Correct |
20 ms |
4616 KB |
Output is correct |
111 |
Correct |
17 ms |
4752 KB |
Output is correct |
112 |
Correct |
6 ms |
4584 KB |
Output is correct |
113 |
Correct |
34 ms |
4604 KB |
Output is correct |
114 |
Correct |
5 ms |
4500 KB |
Output is correct |
115 |
Correct |
12 ms |
4780 KB |
Output is correct |
116 |
Correct |
13 ms |
4588 KB |
Output is correct |
117 |
Correct |
18 ms |
4760 KB |
Output is correct |
118 |
Correct |
18 ms |
4808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
814 ms |
31816 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |