#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define SIZE(x) (int)x.size()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define pb push_back
typedef vector<int> vi;
int n;
bool dfs(int u, vi &v, vi &s, int a) {
if(u>=n) {
if(v[u]) return false;
v[u]=a;
return true;
}
s[u]^=1;
if(s[u]) return dfs(2*u,v,s,a);
return dfs(2*u+1,v,s,a);
}
void create_circuit(int m, vi A) {
vi c(m+1);
c[0]=A[0];
forsn(i,1,m+1) c[i]=-1;
n=1;
while(n<SIZE(A)) n*=2;
int k=n-SIZE(A);
vi a;
forsn(i,1,SIZE(A)) a.pb(A[i]);
a.pb(0);
vi v(2*n,0), s(n,0);
forn(i,n) v[i] = -i-1;
forsn(i,n,n+k) v[i]= -1;
forn(i,SIZE(a)) {
bool flag=false;
while(!flag) flag=dfs(0,v,s,a[i]);
}
vi state(2*n,0);
vi x(n), y(n);
forn(i,n) x[i]=v[2*i], y[i]=v[2*i+1];
answer(c,x,y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
2 |
Correct |
49 ms |
7628 KB |
Output is correct |
3 |
Partially correct |
73 ms |
13264 KB |
Output is partially correct |
4 |
Partially correct |
86 ms |
14140 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
2 |
Correct |
49 ms |
7628 KB |
Output is correct |
3 |
Partially correct |
73 ms |
13264 KB |
Output is partially correct |
4 |
Partially correct |
86 ms |
14140 KB |
Output is partially correct |
5 |
Partially correct |
83 ms |
14536 KB |
Output is partially correct |
6 |
Partially correct |
83 ms |
14276 KB |
Output is partially correct |
7 |
Partially correct |
80 ms |
14288 KB |
Output is partially correct |
8 |
Partially correct |
77 ms |
14256 KB |
Output is partially correct |
9 |
Partially correct |
72 ms |
13256 KB |
Output is partially correct |
10 |
Partially correct |
80 ms |
14024 KB |
Output is partially correct |
11 |
Partially correct |
78 ms |
14024 KB |
Output is partially correct |
12 |
Partially correct |
69 ms |
13260 KB |
Output is partially correct |
13 |
Correct |
41 ms |
7636 KB |
Output is correct |
14 |
Partially correct |
89 ms |
13508 KB |
Output is partially correct |
15 |
Partially correct |
92 ms |
13500 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
860 KB |
Output is partially correct |
17 |
Correct |
39 ms |
7628 KB |
Output is correct |
18 |
Correct |
40 ms |
7632 KB |
Output is correct |
19 |
Partially correct |
74 ms |
13360 KB |
Output is partially correct |
20 |
Partially correct |
78 ms |
14024 KB |
Output is partially correct |
21 |
Partially correct |
75 ms |
14032 KB |
Output is partially correct |
22 |
Partially correct |
75 ms |
14024 KB |
Output is partially correct |