Submission #94317

#TimeUsernameProblemLanguageResultExecution timeMemory
94317fjzzq2002Cave (IOI13_cave)C++14
100 / 100
757 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define tryy tryCombination void exploreCave(int N) { vector<int> v; int o1[5005],o2[5005],t[5005],x1[5005],x2[5005]; for(int i=0;i<N;++i) v.push_back(i),t[i]=0; for(int i=0;i<N;++i) { if(tryy(t)==i) for(auto x:v) t[x]^=1; int l=1,r=v.size(); while(l<r) { int m=(l+r)>>1; for(int j=0;j<m;++j) t[v[j]]^=1; if(tryy(t)==i) r=m; else l=m+1; for(int j=0;j<m;++j) t[v[j]]^=1; } --l; o1[i]=v[l]; o2[i]=!t[o1[i]]; v.erase(v.begin()+l); } if(tryy(t)!=-1) throw "GG"; for(int i=0;i<N;++i) x1[o1[i]]=i,x2[o1[i]]=!o2[i]; answer(x2,x1); }
#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...