Submission #969776

#TimeUsernameProblemLanguageResultExecution timeMemory
969776elotelo966Cave (IOI13_cave)C++17
0 / 100
133 ms568 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define lim 5005 int arr[lim],arr_use[lim]; bool kesin[lim]; inline void change(int l,int kac,int val){ int cur=l; kac-=l; kac++; while(kac){ if(kesin[cur]){ cur++; } else{ kac--; arr_use[cur]=val; } } } void exploreCave(int N) { int n=N; int ans[n],ans2[n]; for(int i=0;i<n;i++){ int door=tryCombination(arr); if(door!=i)ans[i]=0; //cevap 0da else ans[i]=1; // cevap 1de int l=0,r=n-i-1; while(l<=r){ int m=(l+r)/2; change(l,m,ans[i]^1); int door_use=tryCombination(arr_use); if(door_use!=i)l=m+1; else r=m-1; } ans2[i]=r; kesin[i]=1; arr[r]=ans[i]; for(int i=0;i<n;i++){ arr_use[i]=arr[i]; } } answer(ans,ans2); return ; }
#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...