#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0;i<n;++i)
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
const ll inf = 1e18;
#define pi pair<int,int>
#define f first
#define s second
void mysim(vector<int> c, vector<int> x, vector<int> y) {
int p=0;
int z=1;
int k=x.size();
vector<int> s(k,0);
while (z||p) {
if (!p) {
z=0; p=c[p];
} else if (p>0) {
cout<<p<<"->\n";
p=c[p];
} else {
cout<<"? "<<p<<'\n';
int i=-p-1;
if (s[i]==0) p=x[i];
else p=y[i];
s[i]^=1;
}
}
}
void create_circuit(int m, vector<int>a) {
vector<int> c(m+1,-1); c[0]=a[0];
int n=a.size();
int sz=1; while (2*sz<n) sz<<=1;
vector<int> x(2*sz-1,-1), y(2*sz-1,-1);
forn(i,sz-1) x[i]=2*i+1, y[i]=2*i+2;
forn(i,sz-1) x[i]=-1-x[i], y[i]=-1-y[i];
vector<int> s(2*sz-1,1);
vector<pi> z;
forn(it,2*sz) {
int p=0;
while (p<sz-1) {
s[p]^=1;
p=2*p+1+s[p];
}
s[p]^=1;
z.pb({p,s[p]});
}
forn(i,n-1) {
if (z[i].s) y[z[i].f]=a[i+1];
else x[z[i].f]=a[i+1];
}
y[z.back().f]=0;
answer(c,x,y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
296 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Correct |
35 ms |
6812 KB |
Output is correct |
3 |
Partially correct |
66 ms |
11412 KB |
Output is partially correct |
4 |
Partially correct |
70 ms |
12548 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Correct |
35 ms |
6812 KB |
Output is correct |
3 |
Partially correct |
66 ms |
11412 KB |
Output is partially correct |
4 |
Partially correct |
70 ms |
12548 KB |
Output is partially correct |
5 |
Partially correct |
73 ms |
12988 KB |
Output is partially correct |
6 |
Partially correct |
73 ms |
12732 KB |
Output is partially correct |
7 |
Partially correct |
73 ms |
12860 KB |
Output is partially correct |
8 |
Partially correct |
71 ms |
12708 KB |
Output is partially correct |
9 |
Partially correct |
63 ms |
11384 KB |
Output is partially correct |
10 |
Partially correct |
70 ms |
12572 KB |
Output is partially correct |
11 |
Partially correct |
70 ms |
12512 KB |
Output is partially correct |
12 |
Partially correct |
67 ms |
11404 KB |
Output is partially correct |
13 |
Correct |
37 ms |
6948 KB |
Output is correct |
14 |
Partially correct |
66 ms |
11708 KB |
Output is partially correct |
15 |
Partially correct |
65 ms |
11792 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
724 KB |
Output is partially correct |
17 |
Correct |
36 ms |
6904 KB |
Output is correct |
18 |
Correct |
36 ms |
6852 KB |
Output is correct |
19 |
Partially correct |
64 ms |
11500 KB |
Output is partially correct |
20 |
Partially correct |
72 ms |
12492 KB |
Output is partially correct |
21 |
Partially correct |
71 ms |
12576 KB |
Output is partially correct |
22 |
Partially correct |
70 ms |
12484 KB |
Output is partially correct |