#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
void Alice( int N, int M, int A[], int B[] ){
vector<pair<int,int>>EEE;
for(int i=0;i<M;i++)
EEE.push_back({A[i],B[i]});
EEE.push_back({N,N+1});
for(int i=0;i<10;i++)
EEE.push_back({N+1,N+i+2});
for(int i=0;i<9;i++)
EEE.push_back({N+2+i,N+3+i});
EEE.push_back({N+8,N+11});
EEE.push_back({N+8,N+10});
EEE.push_back({N+7,N+9});
int cnt=0;
for(int i=3;cnt<N;i++){
if(__builtin_popcount(i)>1){
for(int j=0;j<10;j++) if(i&1<<j)
EEE.push_back({cnt,N+2+j});
cnt++;
}
}
InitG(N+12,EEE.size());
for(int i=0;i<EEE.size();i++)
MakeG(i,EEE[i].first,EEE[i].second);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
#define CTD(D,I) for(auto i:adj[z]) {if(IN[i]&&i-w&&DEG[i]==D&&i!=v[I]){w=z,v.push_back(z=i);break;}}
vector<int>adj[1012];
int means[1024],val[1012],DEG[1012],IN[1012];
void Bob( int V, int U, int C[], int D[] ){
int CC=0;
for(int i=3;i<1024;i++)
if(__builtin_popcount(i)>1)
means[i]=CC++;
for(int i=0;i<U;i++)
adj[C[i]].push_back(D[i]),
adj[D[i]].push_back(C[i]);
int x,y,z,w=-1;
for(int i=0;i<V;i++)
if(adj[i].size()<2)
x=i;
y=adj[x][0];
for(auto j:adj[y])
IN[j]=1;
for(int i=0;i<V;i++)
for(auto j:adj[i])
DEG[i]+=IN[j];
for(auto i:adj[y])
if(DEG[i]==1)
z=i;
vector<int>v{z};
for(int Q=5;Q--;)for(auto i:adj[z])
if(IN[i]&&i-w){w=z,v.push_back(z=i);break;}
if(v.size()!=6) MakeMap(0,0);
for(auto i:adj[z]) CTD(4,0)
if(v.size()!=7) MakeMap(0,0);
for(auto i:adj[z]){
if(IN[i]&&i-w&&DEG[i]==3&&count(adj[i].begin(),adj[i].end(),v[5])){
w=z,v.push_back(z=i);break;}}
if(v.size()!=8) MakeMap(0,0);
for(auto i:adj[z]) CTD(3,5)
if(v.size()!=9) MakeMap(0,0);
for(auto i:adj[z]) CTD(2,0)
if(v.size()!=10) MakeMap(0,0);
for(int i=0;i<10;i++)
for(auto j:adj[v[i]])
val[j]+=1<<i;
vector<pair<int,int>>EEE;
for(int i=0;i<U;i++) if(!IN[C[i]]&&!IN[D[i]]) {
int A=means[val[C[i]]],B=means[val[D[i]]];
EEE.push_back({A,B});
}
swap(EEE.back(),EEE[0]);
InitMap(V-12,EEE.size());
for(auto[i,j]:EEE)
MakeMap(i,j);
}
Compilation message
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:25:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int i=0;i<EEE.size();i++)
| ~^~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:32:11: warning: unused variable 'i' [-Wunused-variable]
32 | for(auto i:adj[z]) CTD(4,0)
| ^
Bob.cpp:38:11: warning: unused variable 'i' [-Wunused-variable]
38 | for(auto i:adj[z]) CTD(3,5)
| ^
Bob.cpp:40:11: warning: unused variable 'i' [-Wunused-variable]
40 | for(auto i:adj[z]) CTD(2,0)
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15608 KB |
Output is correct |
2 |
Correct |
4 ms |
15620 KB |
Output is correct |
3 |
Correct |
3 ms |
15560 KB |
Output is correct |
4 |
Runtime error |
7 ms |
17924 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
15608 KB |
Output is correct |
2 |
Correct |
4 ms |
15620 KB |
Output is correct |
3 |
Correct |
3 ms |
15560 KB |
Output is correct |
4 |
Runtime error |
7 ms |
17924 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
404 ms |
39276 KB |
Output is correct : V - N = 12 |
2 |
Correct |
407 ms |
38012 KB |
Output is correct : V - N = 12 |
3 |
Correct |
157 ms |
21172 KB |
Output is correct : V - N = 12 |
4 |
Correct |
8 ms |
15844 KB |
Output is correct : V - N = 12 |
5 |
Correct |
81 ms |
18800 KB |
Output is correct : V - N = 12 |
6 |
Correct |
277 ms |
36988 KB |
Output is correct : V - N = 12 |
7 |
Correct |
395 ms |
38292 KB |
Output is correct : V - N = 12 |
8 |
Correct |
402 ms |
39012 KB |
Output is correct : V - N = 12 |
9 |
Correct |
197 ms |
21928 KB |
Output is correct : V - N = 12 |
10 |
Correct |
31 ms |
16732 KB |
Output is correct : V - N = 12 |
11 |
Correct |
36 ms |
17312 KB |
Output is correct : V - N = 12 |
12 |
Correct |
340 ms |
27684 KB |
Output is correct : V - N = 12 |
13 |
Correct |
402 ms |
37904 KB |
Output is correct : V - N = 12 |
14 |
Correct |
499 ms |
38980 KB |
Output is correct : V - N = 12 |
15 |
Correct |
248 ms |
33192 KB |
Output is correct : V - N = 12 |
16 |
Correct |
51 ms |
17572 KB |
Output is correct : V - N = 12 |
17 |
Correct |
14 ms |
16580 KB |
Output is correct : V - N = 12 |
18 |
Correct |
181 ms |
21664 KB |
Output is correct : V - N = 12 |
19 |
Correct |
346 ms |
38112 KB |
Output is correct : V - N = 12 |
20 |
Correct |
589 ms |
39160 KB |
Output is correct : V - N = 12 |
21 |
Correct |
131 ms |
19888 KB |
Output is correct : V - N = 12 |
22 |
Correct |
143 ms |
18968 KB |
Output is correct : V - N = 12 |
23 |
Correct |
30 ms |
17564 KB |
Output is correct : V - N = 12 |
24 |
Correct |
5 ms |
15620 KB |
Output is correct : V - N = 12 |
25 |
Correct |
21 ms |
16448 KB |
Output is correct : V - N = 12 |
26 |
Correct |
105 ms |
18380 KB |
Output is correct : V - N = 12 |
27 |
Correct |
153 ms |
18876 KB |
Output is correct : V - N = 12 |
28 |
Correct |
90 ms |
18616 KB |
Output is correct : V - N = 12 |
29 |
Correct |
80 ms |
17408 KB |
Output is correct : V - N = 12 |
30 |
Correct |
7 ms |
16088 KB |
Output is correct : V - N = 12 |
31 |
Runtime error |
9 ms |
18188 KB |
Execution killed with signal 11 |
32 |
Halted |
0 ms |
0 KB |
- |