제출 #297267

#제출 시각아이디문제언어결과실행 시간메모리
297267eohomegrownapps자동 인형 (IOI18_doll)C++14
37 / 100
125 ms9016 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> adjlist; vector<int> exitto; vector<int> switchxto; vector<int> switchyto; int sind = 0; int l2; int getcomp(int v){ int ans = 0; for (int i = 0; i<l2; i++){ if ((1<<i)&v){ ans+=1<<(l2-i-1); } } return ans; } void create_circuit(int m, std::vector<int> a) { int n = a.size(); if (1<<(int(log2(n-1)+1))==n){n++;} l2 = log2(n-1)+1; int powtwo = 1<<(l2); switchxto.resize(powtwo-1); switchyto.resize(powtwo-1); for (int i = 1; i<=powtwo-1; i++){ switchxto[i-1]=-2*i; switchyto[i-1]=-2*i-1; } a.resize(powtwo,-1); a[powtwo-1]=0; for (int i = 0; i<powtwo/2; i++){ switchxto[powtwo/2+i-1]=a[getcomp(2*i)]; switchyto[powtwo/2+i-1]=a[getcomp(2*i+1)]; } /*for (int i : switchxto){ cout<<i<<' '; }cout<<'\n'; for (int i : switchyto){ cout<<i<<' '; }cout<<'\n'; for (int i : a){ cout<<i<<' '; }cout<<'\n';*/ exitto.resize(m+1,-1); answer(exitto,switchxto,switchyto); }
#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...