Submission #1245251

#TimeUsernameProblemLanguageResultExecution timeMemory
1245251boyan2010Cave (IOI13_cave)C++20
0 / 100
175 ms564 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; int s[5007],d[5007],temps[5007],n; bool u[5007]; void f(int i) { vector<int>left; for(int j=1;j<=n;j++) { if(u[j]) { temps[j]=s[j]; } else { left.push_back(j); temps[j]=0; } } int temp=tryCombination(temps); bool type; if(temp==i) { type=0; } else { type=1; } int l=0,r=left.size()-1; while(r>=l) { int m=(l+r)/2; for(auto el:left) { temps[el]=(!type); } for(int j=l;j<=m;j++) { temps[left[j]]=type; } temp=tryCombination(temps); if(temp==i) { r=m-1; } else { l=m+1; } } u[left[l]]=1; d[left[l]]=i; s[left[l]]=type; } void exploreCave(int N) { n=N; for(int i=1;i<=n;i++) { f(i); } answer(s,d); }
#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...