이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 >= N){ //last node??
tree[node] = tree[node] ^ 1;
return mp(tree[node] ^ 1, node);
}
if (tree[node]){
tree[node] = tree[node] ^ 1;
return trial(node*2 + 1);
}
else{
tree[node] = tree[node] ^ 1;
return trial(node*2);
}
}
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(1);
c[a[i]] = -1;
if (tmp.xx == 0){
x[tmp.yy - 1] = a[i];
}
else{
y[tmp.yy - 1] = a[i];
}
}
for (int i = 1; i <= n; i++){
if (i*2 >= n) break;
x[i - 1] = -i*2;
if (i*2 + 1 >= n) break;
y[i - 1] = -(i*2 + 1);
}
// switch with N different outputs
// for (int X : y){
// cout << X << ' ';
// }
answer(c, x, y);
}
// int main(){ // DRIVER - CHAN
// create_circuit(3, {1});
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |