제출 #130472

#제출 시각아이디문제언어결과실행 시간메모리
130472khulegub자동 인형 (IOI18_doll)C++14
0 / 100
1 ms204 KiB
#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; vector<int> x, y; pii trial(int node){ x[node] = node*2; y[node] = node*2 + 1; 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) ); x.resize(N); y.resize(N); tree.resize(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] = a[i]; } else{ y[tmp.yy] = a[i]; } } // switch with N different outputs answer(c, x, y); } // int main(){ // DRIVER - CHAN // create_circuit(2, {1, 2, 2, 1}); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...