#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<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 (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[1005];
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}
};
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[x]][ord[y]]) ans.pub({x,y});
}
InitMap(n-12,sz(ans));
for (auto &it:ans) MakeMap(it.fi,it.se);
}
Compilation message
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:93:28: warning: 'idx2' may be used uninitialized in this function [-Wmaybe-uninitialized]
93 | rep(x,0,n) if (x!=idx && x!=idx2){
| ~^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
4588 KB |
Output is correct |
2 |
Correct |
12 ms |
4588 KB |
Output is correct |
3 |
Correct |
24 ms |
4604 KB |
Output is correct |
4 |
Correct |
14 ms |
4596 KB |
Output is correct |
5 |
Correct |
27 ms |
4600 KB |
Output is correct |
6 |
Correct |
9 ms |
4588 KB |
Output is correct |
7 |
Correct |
4 ms |
4516 KB |
Output is correct |
8 |
Correct |
14 ms |
4588 KB |
Output is correct |
9 |
Correct |
26 ms |
4588 KB |
Output is correct |
10 |
Correct |
31 ms |
4584 KB |
Output is correct |
11 |
Correct |
36 ms |
4632 KB |
Output is correct |
12 |
Correct |
34 ms |
4516 KB |
Output is correct |
13 |
Correct |
23 ms |
4596 KB |
Output is correct |
14 |
Correct |
8 ms |
4588 KB |
Output is correct |
15 |
Correct |
31 ms |
4584 KB |
Output is correct |
16 |
Correct |
17 ms |
4496 KB |
Output is correct |
17 |
Correct |
27 ms |
4588 KB |
Output is correct |
18 |
Correct |
19 ms |
4608 KB |
Output is correct |
19 |
Correct |
30 ms |
4588 KB |
Output is correct |
20 |
Correct |
11 ms |
4588 KB |
Output is correct |
21 |
Correct |
6 ms |
4588 KB |
Output is correct |
22 |
Correct |
23 ms |
4528 KB |
Output is correct |
23 |
Correct |
28 ms |
4588 KB |
Output is correct |
24 |
Correct |
27 ms |
4564 KB |
Output is correct |
25 |
Correct |
26 ms |
4516 KB |
Output is correct |
26 |
Correct |
18 ms |
4644 KB |
Output is correct |
27 |
Correct |
3 ms |
4588 KB |
Output is correct |
28 |
Correct |
13 ms |
4580 KB |
Output is correct |
29 |
Correct |
8 ms |
4588 KB |
Output is correct |
30 |
Correct |
32 ms |
4592 KB |
Output is correct |
31 |
Correct |
5 ms |
4584 KB |
Output is correct |
32 |
Correct |
6 ms |
4584 KB |
Output is correct |
33 |
Correct |
8 ms |
4584 KB |
Output is correct |
34 |
Correct |
7 ms |
4564 KB |
Output is correct |
35 |
Correct |
33 ms |
4584 KB |
Output is correct |
36 |
Correct |
15 ms |
4588 KB |
Output is correct |
37 |
Correct |
30 ms |
4588 KB |
Output is correct |
38 |
Correct |
33 ms |
4584 KB |
Output is correct |
39 |
Correct |
28 ms |
4588 KB |
Output is correct |
40 |
Correct |
27 ms |
4584 KB |
Output is correct |
41 |
Correct |
24 ms |
4596 KB |
Output is correct |
42 |
Correct |
34 ms |
4588 KB |
Output is correct |
43 |
Correct |
22 ms |
4600 KB |
Output is correct |
44 |
Correct |
20 ms |
4584 KB |
Output is correct |
45 |
Correct |
10 ms |
4516 KB |
Output is correct |
46 |
Correct |
31 ms |
4808 KB |
Output is correct |
47 |
Correct |
32 ms |
4588 KB |
Output is correct |
48 |
Correct |
13 ms |
4644 KB |
Output is correct |
49 |
Correct |
14 ms |
4588 KB |
Output is correct |
50 |
Correct |
3 ms |
4584 KB |
Output is correct |
51 |
Correct |
39 ms |
4584 KB |
Output is correct |
52 |
Correct |
9 ms |
4588 KB |
Output is correct |
53 |
Correct |
16 ms |
4564 KB |
Output is correct |
54 |
Correct |
19 ms |
4588 KB |
Output is correct |
55 |
Correct |
18 ms |
4588 KB |
Output is correct |
56 |
Correct |
12 ms |
4568 KB |
Output is correct |
57 |
Correct |
27 ms |
4568 KB |
Output is correct |
58 |
Correct |
19 ms |
4596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
4588 KB |
Output is correct |
2 |
Correct |
12 ms |
4588 KB |
Output is correct |
3 |
Correct |
24 ms |
4604 KB |
Output is correct |
4 |
Correct |
14 ms |
4596 KB |
Output is correct |
5 |
Correct |
27 ms |
4600 KB |
Output is correct |
6 |
Correct |
9 ms |
4588 KB |
Output is correct |
7 |
Correct |
4 ms |
4516 KB |
Output is correct |
8 |
Correct |
14 ms |
4588 KB |
Output is correct |
9 |
Correct |
26 ms |
4588 KB |
Output is correct |
10 |
Correct |
31 ms |
4584 KB |
Output is correct |
11 |
Correct |
36 ms |
4632 KB |
Output is correct |
12 |
Correct |
34 ms |
4516 KB |
Output is correct |
13 |
Correct |
23 ms |
4596 KB |
Output is correct |
14 |
Correct |
8 ms |
4588 KB |
Output is correct |
15 |
Correct |
31 ms |
4584 KB |
Output is correct |
16 |
Correct |
17 ms |
4496 KB |
Output is correct |
17 |
Correct |
27 ms |
4588 KB |
Output is correct |
18 |
Correct |
19 ms |
4608 KB |
Output is correct |
19 |
Correct |
30 ms |
4588 KB |
Output is correct |
20 |
Correct |
11 ms |
4588 KB |
Output is correct |
21 |
Correct |
6 ms |
4588 KB |
Output is correct |
22 |
Correct |
23 ms |
4528 KB |
Output is correct |
23 |
Correct |
28 ms |
4588 KB |
Output is correct |
24 |
Correct |
27 ms |
4564 KB |
Output is correct |
25 |
Correct |
26 ms |
4516 KB |
Output is correct |
26 |
Correct |
18 ms |
4644 KB |
Output is correct |
27 |
Correct |
3 ms |
4588 KB |
Output is correct |
28 |
Correct |
13 ms |
4580 KB |
Output is correct |
29 |
Correct |
8 ms |
4588 KB |
Output is correct |
30 |
Correct |
32 ms |
4592 KB |
Output is correct |
31 |
Correct |
5 ms |
4584 KB |
Output is correct |
32 |
Correct |
6 ms |
4584 KB |
Output is correct |
33 |
Correct |
8 ms |
4584 KB |
Output is correct |
34 |
Correct |
7 ms |
4564 KB |
Output is correct |
35 |
Correct |
33 ms |
4584 KB |
Output is correct |
36 |
Correct |
15 ms |
4588 KB |
Output is correct |
37 |
Correct |
30 ms |
4588 KB |
Output is correct |
38 |
Correct |
33 ms |
4584 KB |
Output is correct |
39 |
Correct |
28 ms |
4588 KB |
Output is correct |
40 |
Correct |
27 ms |
4584 KB |
Output is correct |
41 |
Correct |
24 ms |
4596 KB |
Output is correct |
42 |
Correct |
34 ms |
4588 KB |
Output is correct |
43 |
Correct |
22 ms |
4600 KB |
Output is correct |
44 |
Correct |
20 ms |
4584 KB |
Output is correct |
45 |
Correct |
10 ms |
4516 KB |
Output is correct |
46 |
Correct |
31 ms |
4808 KB |
Output is correct |
47 |
Correct |
32 ms |
4588 KB |
Output is correct |
48 |
Correct |
13 ms |
4644 KB |
Output is correct |
49 |
Correct |
14 ms |
4588 KB |
Output is correct |
50 |
Correct |
3 ms |
4584 KB |
Output is correct |
51 |
Correct |
39 ms |
4584 KB |
Output is correct |
52 |
Correct |
9 ms |
4588 KB |
Output is correct |
53 |
Correct |
16 ms |
4564 KB |
Output is correct |
54 |
Correct |
19 ms |
4588 KB |
Output is correct |
55 |
Correct |
18 ms |
4588 KB |
Output is correct |
56 |
Correct |
12 ms |
4568 KB |
Output is correct |
57 |
Correct |
27 ms |
4568 KB |
Output is correct |
58 |
Correct |
19 ms |
4596 KB |
Output is correct |
59 |
Correct |
17 ms |
4824 KB |
Output is correct |
60 |
Correct |
12 ms |
4824 KB |
Output is correct |
61 |
Correct |
17 ms |
4596 KB |
Output is correct |
62 |
Correct |
31 ms |
4516 KB |
Output is correct |
63 |
Correct |
26 ms |
4628 KB |
Output is correct |
64 |
Correct |
9 ms |
4852 KB |
Output is correct |
65 |
Correct |
28 ms |
4760 KB |
Output is correct |
66 |
Correct |
27 ms |
4728 KB |
Output is correct |
67 |
Correct |
31 ms |
4752 KB |
Output is correct |
68 |
Correct |
15 ms |
4644 KB |
Output is correct |
69 |
Correct |
14 ms |
4640 KB |
Output is correct |
70 |
Correct |
16 ms |
4840 KB |
Output is correct |
71 |
Correct |
8 ms |
4768 KB |
Output is correct |
72 |
Correct |
18 ms |
4844 KB |
Output is correct |
73 |
Correct |
24 ms |
4852 KB |
Output is correct |
74 |
Correct |
17 ms |
4644 KB |
Output is correct |
75 |
Correct |
8 ms |
4568 KB |
Output is correct |
76 |
Correct |
28 ms |
4764 KB |
Output is correct |
77 |
Correct |
20 ms |
4836 KB |
Output is correct |
78 |
Correct |
17 ms |
4756 KB |
Output is correct |
79 |
Correct |
23 ms |
4760 KB |
Output is correct |
80 |
Correct |
22 ms |
4644 KB |
Output is correct |
81 |
Correct |
34 ms |
4528 KB |
Output is correct |
82 |
Correct |
3 ms |
4588 KB |
Output is correct |
83 |
Correct |
20 ms |
4588 KB |
Output is correct |
84 |
Correct |
20 ms |
4740 KB |
Output is correct |
85 |
Correct |
9 ms |
4844 KB |
Output is correct |
86 |
Correct |
16 ms |
4844 KB |
Output is correct |
87 |
Correct |
31 ms |
4632 KB |
Output is correct |
88 |
Correct |
25 ms |
4588 KB |
Output is correct |
89 |
Correct |
18 ms |
4580 KB |
Output is correct |
90 |
Correct |
23 ms |
4516 KB |
Output is correct |
91 |
Correct |
14 ms |
4596 KB |
Output is correct |
92 |
Correct |
6 ms |
4516 KB |
Output is correct |
93 |
Correct |
12 ms |
4540 KB |
Output is correct |
94 |
Correct |
13 ms |
4796 KB |
Output is correct |
95 |
Correct |
24 ms |
4780 KB |
Output is correct |
96 |
Correct |
36 ms |
4752 KB |
Output is correct |
97 |
Correct |
19 ms |
4772 KB |
Output is correct |
98 |
Correct |
16 ms |
4756 KB |
Output is correct |
99 |
Correct |
25 ms |
4848 KB |
Output is correct |
100 |
Correct |
34 ms |
4748 KB |
Output is correct |
101 |
Correct |
11 ms |
4716 KB |
Output is correct |
102 |
Correct |
11 ms |
4596 KB |
Output is correct |
103 |
Correct |
28 ms |
4652 KB |
Output is correct |
104 |
Correct |
6 ms |
4716 KB |
Output is correct |
105 |
Correct |
6 ms |
4696 KB |
Output is correct |
106 |
Correct |
24 ms |
4752 KB |
Output is correct |
107 |
Correct |
6 ms |
4624 KB |
Output is correct |
108 |
Correct |
19 ms |
4588 KB |
Output is correct |
109 |
Correct |
28 ms |
4780 KB |
Output is correct |
110 |
Correct |
18 ms |
4624 KB |
Output is correct |
111 |
Correct |
26 ms |
4736 KB |
Output is correct |
112 |
Correct |
20 ms |
4600 KB |
Output is correct |
113 |
Correct |
7 ms |
4548 KB |
Output is correct |
114 |
Correct |
30 ms |
4596 KB |
Output is correct |
115 |
Correct |
26 ms |
4780 KB |
Output is correct |
116 |
Correct |
17 ms |
4596 KB |
Output is correct |
117 |
Correct |
28 ms |
4620 KB |
Output is correct |
118 |
Correct |
18 ms |
4828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3696 ms |
25508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |