#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void Alice(int n, int m, int a[], int b[])
{
int L=10;
vector<pair<int,int> > edges;
int cen=n+L,den=n+L+1,i,j;
for(i=0;i<L-1;i++) edges.pb(mp(n+i,n+i+1));
for(i=0;i<n;i++)
{
edges.pb(mp(i,cen));
edges.pb(mp(i,den));
for(j=0;j<L;j++) if((i>>j)&1) edges.pb(mp(i,n+j));
}
for(i=0;i<L;i++) edges.pb(mp(n+i,den));
for(i=0;i<m;i++) edges.pb(mp(a[i],b[i]));
InitG(n+L+2,edges.size());
for(i=0;i<edges.size();i++) MakeG(i,edges[i].first,edges[i].second);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
vector<vector<int> > E;
vector<int> fk,val;
void DFS(int u, int p, int d)
{
val[u]=d;
for(int v:E[u]) if(v!=p && fk[v]==1) DFS(v,u,d+1);
}
void Bob(int n, int m, int a[], int b[])
{
int L=10,N=n-L-2,i;E.clear();E.resize(n);
vector<int> deg(n,0);set<pair<int,int> > es;
for(i=0;i<m;i++) deg[a[i]]++,deg[b[i]]++,es.insert(mp(a[i],b[i])),es.insert(mp(b[i],a[i]));
for(i=0;i<m;i++) E[a[i]].pb(b[i]),E[b[i]].pb(a[i]);
int den,cen;
for(i=0;i<n;i++) if(deg[i]==n-2) den=i;
for(i=0;i<n;i++)
{
if(i==den) continue;
if(es.count(mp(i,den))) continue;
cen=i;
}
fk.resize(n);fk[cen]=fk[den]=2;val.resize(n);
for(i=0;i<n;i++) if(i!=cen && i!=den && !es.count(mp(cen,i))) fk[i]=1;
int one;
for(i=0;i<n;i++)
{
if(fk[i]==1)
{
int c=0,d=0;
for(int v:E[i]){ if(fk[v]==0) c++;if(fk[v]==1) d++;}
if(c==N/2 && d==1) one=i;
}
}
DFS(one,-1,0);
for(i=0;i<n;i++) if(fk[i]==0)
{
for(int v:E[i]) if(fk[v]==1) val[i]+=1<<val[v];
}
vector<pair<int,int> > edges;
for(i=0;i<m;i++)
{
if(fk[a[i]]==0 && fk[b[i]]==0) edges.pb(mp(val[a[i]],val[b[i]]));
}
InitMap(N,edges.size());
for(i=0;i<edges.size();i++) MakeMap(edges[i].first,edges[i].second);
}
Compilation message
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:22:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=0;i<edges.size();i++) MakeG(i,edges[i].first,edges[i].second);
~^~~~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:52:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=0;i<edges.size();i++) MakeMap(edges[i].first,edges[i].second);
~^~~~~~~~~~~~~
Bob.cpp:41:5: warning: 'one' may be used uninitialized in this function [-Wmaybe-uninitialized]
DFS(one,-1,0);
~~~^~~~~~~~~~
Bob.cpp:30:29: warning: 'den' may be used uninitialized in this function [-Wmaybe-uninitialized]
for(i=0;i<n;i++) if(i!=cen && i!=den && !es.count(mp(cen,i))) fk[i]=1;
~~~~~~~^~~~~~~~~
Bob.cpp:30:54: warning: 'cen' may be used uninitialized in this function [-Wmaybe-uninitialized]
for(i=0;i<n;i++) if(i!=cen && i!=den && !es.count(mp(cen,i))) fk[i]=1;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
6640 KB |
Output is correct |
2 |
Correct |
8 ms |
6896 KB |
Output is correct |
3 |
Correct |
8 ms |
6696 KB |
Output is correct |
4 |
Correct |
8 ms |
6896 KB |
Output is correct |
5 |
Correct |
7 ms |
6640 KB |
Output is correct |
6 |
Correct |
8 ms |
6736 KB |
Output is correct |
7 |
Correct |
7 ms |
6640 KB |
Output is correct |
8 |
Correct |
8 ms |
6648 KB |
Output is correct |
9 |
Correct |
8 ms |
6640 KB |
Output is correct |
10 |
Correct |
8 ms |
6640 KB |
Output is correct |
11 |
Correct |
8 ms |
6736 KB |
Output is correct |
12 |
Correct |
7 ms |
6640 KB |
Output is correct |
13 |
Correct |
7 ms |
6640 KB |
Output is correct |
14 |
Correct |
8 ms |
6896 KB |
Output is correct |
15 |
Correct |
8 ms |
6896 KB |
Output is correct |
16 |
Correct |
8 ms |
6736 KB |
Output is correct |
17 |
Correct |
8 ms |
6640 KB |
Output is correct |
18 |
Correct |
8 ms |
6640 KB |
Output is correct |
19 |
Correct |
7 ms |
6736 KB |
Output is correct |
20 |
Correct |
8 ms |
6896 KB |
Output is correct |
21 |
Correct |
8 ms |
6896 KB |
Output is correct |
22 |
Correct |
8 ms |
6896 KB |
Output is correct |
23 |
Correct |
8 ms |
6640 KB |
Output is correct |
24 |
Correct |
8 ms |
6640 KB |
Output is correct |
25 |
Correct |
7 ms |
6640 KB |
Output is correct |
26 |
Correct |
8 ms |
6640 KB |
Output is correct |
27 |
Correct |
8 ms |
6640 KB |
Output is correct |
28 |
Correct |
8 ms |
6896 KB |
Output is correct |
29 |
Correct |
7 ms |
6640 KB |
Output is correct |
30 |
Correct |
8 ms |
6896 KB |
Output is correct |
31 |
Correct |
7 ms |
6952 KB |
Output is correct |
32 |
Correct |
7 ms |
6896 KB |
Output is correct |
33 |
Correct |
7 ms |
6640 KB |
Output is correct |
34 |
Correct |
8 ms |
6640 KB |
Output is correct |
35 |
Correct |
8 ms |
6896 KB |
Output is correct |
36 |
Correct |
8 ms |
6896 KB |
Output is correct |
37 |
Correct |
7 ms |
6736 KB |
Output is correct |
38 |
Correct |
8 ms |
6896 KB |
Output is correct |
39 |
Correct |
8 ms |
6736 KB |
Output is correct |
40 |
Correct |
8 ms |
6640 KB |
Output is correct |
41 |
Correct |
8 ms |
6640 KB |
Output is correct |
42 |
Correct |
7 ms |
6640 KB |
Output is correct |
43 |
Correct |
7 ms |
6896 KB |
Output is correct |
44 |
Correct |
7 ms |
6640 KB |
Output is correct |
45 |
Correct |
8 ms |
6904 KB |
Output is correct |
46 |
Correct |
7 ms |
6984 KB |
Output is correct |
47 |
Correct |
6 ms |
6640 KB |
Output is correct |
48 |
Correct |
7 ms |
6896 KB |
Output is correct |
49 |
Correct |
7 ms |
6568 KB |
Output is correct |
50 |
Correct |
8 ms |
6736 KB |
Output is correct |
51 |
Correct |
8 ms |
6640 KB |
Output is correct |
52 |
Correct |
7 ms |
6896 KB |
Output is correct |
53 |
Correct |
7 ms |
6936 KB |
Output is correct |
54 |
Correct |
8 ms |
6640 KB |
Output is correct |
55 |
Correct |
7 ms |
6896 KB |
Output is correct |
56 |
Correct |
8 ms |
6736 KB |
Output is correct |
57 |
Correct |
8 ms |
6736 KB |
Output is correct |
58 |
Correct |
7 ms |
6744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
6640 KB |
Output is correct |
2 |
Correct |
8 ms |
6896 KB |
Output is correct |
3 |
Correct |
8 ms |
6696 KB |
Output is correct |
4 |
Correct |
8 ms |
6896 KB |
Output is correct |
5 |
Correct |
7 ms |
6640 KB |
Output is correct |
6 |
Correct |
8 ms |
6736 KB |
Output is correct |
7 |
Correct |
7 ms |
6640 KB |
Output is correct |
8 |
Correct |
8 ms |
6648 KB |
Output is correct |
9 |
Correct |
8 ms |
6640 KB |
Output is correct |
10 |
Correct |
8 ms |
6640 KB |
Output is correct |
11 |
Correct |
8 ms |
6736 KB |
Output is correct |
12 |
Correct |
7 ms |
6640 KB |
Output is correct |
13 |
Correct |
7 ms |
6640 KB |
Output is correct |
14 |
Correct |
8 ms |
6896 KB |
Output is correct |
15 |
Correct |
8 ms |
6896 KB |
Output is correct |
16 |
Correct |
8 ms |
6736 KB |
Output is correct |
17 |
Correct |
8 ms |
6640 KB |
Output is correct |
18 |
Correct |
8 ms |
6640 KB |
Output is correct |
19 |
Correct |
7 ms |
6736 KB |
Output is correct |
20 |
Correct |
8 ms |
6896 KB |
Output is correct |
21 |
Correct |
8 ms |
6896 KB |
Output is correct |
22 |
Correct |
8 ms |
6896 KB |
Output is correct |
23 |
Correct |
8 ms |
6640 KB |
Output is correct |
24 |
Correct |
8 ms |
6640 KB |
Output is correct |
25 |
Correct |
7 ms |
6640 KB |
Output is correct |
26 |
Correct |
8 ms |
6640 KB |
Output is correct |
27 |
Correct |
8 ms |
6640 KB |
Output is correct |
28 |
Correct |
8 ms |
6896 KB |
Output is correct |
29 |
Correct |
7 ms |
6640 KB |
Output is correct |
30 |
Correct |
8 ms |
6896 KB |
Output is correct |
31 |
Correct |
7 ms |
6952 KB |
Output is correct |
32 |
Correct |
7 ms |
6896 KB |
Output is correct |
33 |
Correct |
7 ms |
6640 KB |
Output is correct |
34 |
Correct |
8 ms |
6640 KB |
Output is correct |
35 |
Correct |
8 ms |
6896 KB |
Output is correct |
36 |
Correct |
8 ms |
6896 KB |
Output is correct |
37 |
Correct |
7 ms |
6736 KB |
Output is correct |
38 |
Correct |
8 ms |
6896 KB |
Output is correct |
39 |
Correct |
8 ms |
6736 KB |
Output is correct |
40 |
Correct |
8 ms |
6640 KB |
Output is correct |
41 |
Correct |
8 ms |
6640 KB |
Output is correct |
42 |
Correct |
7 ms |
6640 KB |
Output is correct |
43 |
Correct |
7 ms |
6896 KB |
Output is correct |
44 |
Correct |
7 ms |
6640 KB |
Output is correct |
45 |
Correct |
8 ms |
6904 KB |
Output is correct |
46 |
Correct |
7 ms |
6984 KB |
Output is correct |
47 |
Correct |
6 ms |
6640 KB |
Output is correct |
48 |
Correct |
7 ms |
6896 KB |
Output is correct |
49 |
Correct |
7 ms |
6568 KB |
Output is correct |
50 |
Correct |
8 ms |
6736 KB |
Output is correct |
51 |
Correct |
8 ms |
6640 KB |
Output is correct |
52 |
Correct |
7 ms |
6896 KB |
Output is correct |
53 |
Correct |
7 ms |
6936 KB |
Output is correct |
54 |
Correct |
8 ms |
6640 KB |
Output is correct |
55 |
Correct |
7 ms |
6896 KB |
Output is correct |
56 |
Correct |
8 ms |
6736 KB |
Output is correct |
57 |
Correct |
8 ms |
6736 KB |
Output is correct |
58 |
Correct |
7 ms |
6744 KB |
Output is correct |
59 |
Correct |
8 ms |
6640 KB |
Output is correct |
60 |
Correct |
8 ms |
6640 KB |
Output is correct |
61 |
Correct |
8 ms |
6640 KB |
Output is correct |
62 |
Correct |
8 ms |
6896 KB |
Output is correct |
63 |
Correct |
8 ms |
6736 KB |
Output is correct |
64 |
Correct |
8 ms |
6896 KB |
Output is correct |
65 |
Correct |
8 ms |
6736 KB |
Output is correct |
66 |
Correct |
8 ms |
6640 KB |
Output is correct |
67 |
Correct |
8 ms |
6744 KB |
Output is correct |
68 |
Correct |
8 ms |
6640 KB |
Output is correct |
69 |
Correct |
8 ms |
6696 KB |
Output is correct |
70 |
Correct |
8 ms |
6640 KB |
Output is correct |
71 |
Correct |
8 ms |
6640 KB |
Output is correct |
72 |
Correct |
8 ms |
6896 KB |
Output is correct |
73 |
Correct |
8 ms |
6640 KB |
Output is correct |
74 |
Correct |
8 ms |
6896 KB |
Output is correct |
75 |
Correct |
7 ms |
6736 KB |
Output is correct |
76 |
Correct |
8 ms |
6648 KB |
Output is correct |
77 |
Correct |
8 ms |
6896 KB |
Output is correct |
78 |
Correct |
8 ms |
6896 KB |
Output is correct |
79 |
Correct |
8 ms |
6640 KB |
Output is correct |
80 |
Correct |
8 ms |
6896 KB |
Output is correct |
81 |
Correct |
8 ms |
6896 KB |
Output is correct |
82 |
Correct |
8 ms |
6640 KB |
Output is correct |
83 |
Correct |
8 ms |
6896 KB |
Output is correct |
84 |
Correct |
8 ms |
6896 KB |
Output is correct |
85 |
Correct |
8 ms |
6896 KB |
Output is correct |
86 |
Correct |
8 ms |
6640 KB |
Output is correct |
87 |
Correct |
8 ms |
6640 KB |
Output is correct |
88 |
Correct |
8 ms |
6896 KB |
Output is correct |
89 |
Correct |
8 ms |
6896 KB |
Output is correct |
90 |
Correct |
7 ms |
6896 KB |
Output is correct |
91 |
Correct |
8 ms |
6640 KB |
Output is correct |
92 |
Correct |
8 ms |
6640 KB |
Output is correct |
93 |
Correct |
8 ms |
6640 KB |
Output is correct |
94 |
Correct |
8 ms |
6736 KB |
Output is correct |
95 |
Correct |
8 ms |
6736 KB |
Output is correct |
96 |
Correct |
8 ms |
6736 KB |
Output is correct |
97 |
Correct |
8 ms |
6896 KB |
Output is correct |
98 |
Correct |
8 ms |
6640 KB |
Output is correct |
99 |
Correct |
8 ms |
6736 KB |
Output is correct |
100 |
Correct |
8 ms |
6640 KB |
Output is correct |
101 |
Correct |
8 ms |
6640 KB |
Output is correct |
102 |
Correct |
8 ms |
6640 KB |
Output is correct |
103 |
Correct |
8 ms |
6640 KB |
Output is correct |
104 |
Correct |
8 ms |
6896 KB |
Output is correct |
105 |
Correct |
8 ms |
6640 KB |
Output is correct |
106 |
Correct |
8 ms |
6640 KB |
Output is correct |
107 |
Correct |
8 ms |
6896 KB |
Output is correct |
108 |
Correct |
8 ms |
6640 KB |
Output is correct |
109 |
Correct |
8 ms |
6896 KB |
Output is correct |
110 |
Correct |
7 ms |
6640 KB |
Output is correct |
111 |
Correct |
8 ms |
6640 KB |
Output is correct |
112 |
Correct |
8 ms |
6640 KB |
Output is correct |
113 |
Correct |
8 ms |
6736 KB |
Output is correct |
114 |
Correct |
8 ms |
6896 KB |
Output is correct |
115 |
Correct |
8 ms |
6896 KB |
Output is correct |
116 |
Correct |
8 ms |
6640 KB |
Output is correct |
117 |
Correct |
8 ms |
6736 KB |
Output is correct |
118 |
Correct |
8 ms |
6792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2359 ms |
76796 KB |
Output is correct : V - N = 12 |
2 |
Correct |
1591 ms |
62608 KB |
Output is correct : V - N = 12 |
3 |
Correct |
558 ms |
28176 KB |
Output is correct : V - N = 12 |
4 |
Correct |
19 ms |
7232 KB |
Output is correct : V - N = 12 |
5 |
Correct |
319 ms |
18920 KB |
Output is correct : V - N = 12 |
6 |
Correct |
1298 ms |
54572 KB |
Output is correct : V - N = 12 |
7 |
Correct |
1853 ms |
75576 KB |
Output is correct : V - N = 12 |
8 |
Correct |
1750 ms |
69292 KB |
Output is correct : V - N = 12 |
9 |
Correct |
704 ms |
36868 KB |
Output is correct : V - N = 12 |
10 |
Correct |
69 ms |
9224 KB |
Output is correct : V - N = 12 |
11 |
Correct |
106 ms |
11840 KB |
Output is correct : V - N = 12 |
12 |
Correct |
816 ms |
42688 KB |
Output is correct : V - N = 12 |
13 |
Correct |
2080 ms |
72064 KB |
Output is correct : V - N = 12 |
14 |
Correct |
2111 ms |
73900 KB |
Output is correct : V - N = 12 |
15 |
Correct |
1106 ms |
49892 KB |
Output is correct : V - N = 12 |
16 |
Correct |
159 ms |
14828 KB |
Output is correct : V - N = 12 |
17 |
Correct |
36 ms |
7912 KB |
Output is correct : V - N = 12 |
18 |
Correct |
638 ms |
32724 KB |
Output is correct : V - N = 12 |
19 |
Correct |
1797 ms |
66112 KB |
Output is correct : V - N = 12 |
20 |
Correct |
2065 ms |
76536 KB |
Output is correct : V - N = 12 |
21 |
Correct |
455 ms |
24900 KB |
Output is correct : V - N = 12 |
22 |
Correct |
299 ms |
20016 KB |
Output is correct : V - N = 12 |
23 |
Correct |
99 ms |
11304 KB |
Output is correct : V - N = 12 |
24 |
Correct |
12 ms |
7160 KB |
Output is correct : V - N = 12 |
25 |
Correct |
49 ms |
8768 KB |
Output is correct : V - N = 12 |
26 |
Correct |
231 ms |
18128 KB |
Output is correct : V - N = 12 |
27 |
Correct |
409 ms |
23792 KB |
Output is correct : V - N = 12 |
28 |
Correct |
401 ms |
21956 KB |
Output is correct : V - N = 12 |
29 |
Correct |
149 ms |
13536 KB |
Output is correct : V - N = 12 |
30 |
Correct |
31 ms |
7568 KB |
Output is correct : V - N = 12 |
31 |
Correct |
17 ms |
7248 KB |
Output is correct : V - N = 12 |
32 |
Correct |
16 ms |
7160 KB |
Output is correct : V - N = 12 |
33 |
Correct |
16 ms |
7152 KB |
Output is correct : V - N = 12 |
34 |
Correct |
16 ms |
7152 KB |
Output is correct : V - N = 12 |
35 |
Correct |
17 ms |
7416 KB |
Output is correct : V - N = 12 |
36 |
Correct |
2167 ms |
76980 KB |
Output is correct : V - N = 12 |
37 |
Runtime error |
2321 ms |
1048576 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
38 |
Halted |
0 ms |
0 KB |
- |