#include "doll.h"
#include <bits/stdc++.h>
#define mp make_pair
#define xx first
#define yy second
#define pb push_back
using namespace std;
typedef pair<int, int> pii;
/**********************/
/* YOU ARE INVITED TO */
/* */
/* SUFFER */
/* */
/* ######## */
/* # JOIN # */
/* ######## */
/* */
/**********************/
vector<bool> tree;
int N;
pii trial(int node){
if (node*2 + 1 > N - 2){ //last node??
tree[node] = tree[node] ^ 1;
return mp(tree[node] ^ 1, node);
}
if (tree[node]){ // baruun child
tree[node] = tree[node] ^ 1;
return trial(node*2 + 2);
}
else{
tree[node] = tree[node] ^ 1;
return trial(node*2 + 1);
}
}
void create_circuit(int m, vector<int> a) {
a.pb(0);
int n = a.size();
vector<int> c(m + 1);
N = 1 << (int) ceil( log((double) n)/log(2.0) );
vector<int> x, y;
x.resize(N - 1);
y.resize(N - 1);
tree.resize(N - 1);
// cout << N << '\n';
c[0] = -1; //connect it to first switch
for (int i = 0; i < N; i++){
pii tmp = trial(0);
if (i < n - 1){
c[a[i]] = -1;
// cout << tmp.xx << "&" << tmp.yy << "&" << a[i] << '\n';
if (tmp.xx == 0){
x[tmp.yy] = a[i];
}
else{
y[tmp.yy] = a[i];
}
}
else if (i == N - 1){
if (tmp.xx == 0){
x[tmp.yy] = 0;
}
else{
y[tmp.yy] = 0;
}
}
else{
if (tmp.xx == 0){
x[tmp.yy] = -1;
}
else{
y[tmp.yy] = -1;
}
}
}
for (int i = 0; i * 2 + 1 <= N - 2; i++){
x[i] = -(i*2 + 1 + 1);
y[i] = -(i*2 + 2 + 1);
}
// switch with N different outputs
// for (int X : y){
// cout << X << ' ';
// }
answer(c, x, y);
}
// int main(){ // DRIVER - CHAN
// create_circuit(4, {1, 2, 1, 3});
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
136 ms |
7488 KB |
Output is partially correct |
3 |
Partially correct |
111 ms |
7484 KB |
Output is partially correct |
4 |
Partially correct |
104 ms |
7976 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
136 ms |
7488 KB |
Output is partially correct |
3 |
Partially correct |
111 ms |
7484 KB |
Output is partially correct |
4 |
Partially correct |
104 ms |
7976 KB |
Output is partially correct |
5 |
Partially correct |
130 ms |
8544 KB |
Output is partially correct |
6 |
Partially correct |
116 ms |
8252 KB |
Output is partially correct |
7 |
Partially correct |
103 ms |
8348 KB |
Output is partially correct |
8 |
Partially correct |
105 ms |
8108 KB |
Output is partially correct |
9 |
Partially correct |
95 ms |
7500 KB |
Output is partially correct |
10 |
Partially correct |
116 ms |
8068 KB |
Output is partially correct |
11 |
Partially correct |
98 ms |
7956 KB |
Output is partially correct |
12 |
Partially correct |
120 ms |
7492 KB |
Output is partially correct |
13 |
Partially correct |
92 ms |
7568 KB |
Output is partially correct |
14 |
Partially correct |
110 ms |
7720 KB |
Output is partially correct |
15 |
Partially correct |
102 ms |
7744 KB |
Output is partially correct |
16 |
Partially correct |
4 ms |
588 KB |
Output is partially correct |
17 |
Correct |
54 ms |
5268 KB |
Output is correct |
18 |
Partially correct |
94 ms |
7500 KB |
Output is partially correct |
19 |
Partially correct |
99 ms |
7460 KB |
Output is partially correct |
20 |
Partially correct |
128 ms |
8084 KB |
Output is partially correct |
21 |
Partially correct |
137 ms |
7972 KB |
Output is partially correct |
22 |
Partially correct |
122 ms |
8096 KB |
Output is partially correct |