Submission #993061

#TimeUsernameProblemLanguageResultExecution timeMemory
993061MrM7mdCave (IOI13_cave)C++17
100 / 100
188 ms660 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; // #define int long long #define endl '\n' #define F first #define S second #define pb push_back #define all(a) a.begin(),a.end() const int NN=1e6+50000; const int MOD=1e9+7; const int off=(1<<11); #define ask(x) tryCombination(x); void exploreCave(int N){ int S[N],D[N],done[N]; for(int i=0;i<N;i++){ S[i]=D[i]=done[i]=0; } for(int i=0;i<N;i++){ vector<int>vec; for(int j=0;j<N;j++){ if(done[j])continue; S[j]=0; vec.pb(j); } int x=ask(S); if(x>i || x==-1)x=0; else x=1; int l=0,r=vec.size()-1; int ans = vec[0]; while(l<r){ int md=(l+r)/2; for(int j=l;j<=md;j++){ S[vec[j]]=1; } for(int j=md+1;j<=r;j++){ S[vec[j]]=0; } int cur=ask(S); if(cur == -1) cur = N+1; if(x==1){ if(cur>i){ r=md; ans = vec[md]; } else{ l=md+1; ans=vec[md+1]; } } else{ if(cur>i){ l=md+1; ans = vec[md + 1]; } else{ r=md; ans=vec[md]; } } } D[ans]=i; S[ans]=x; done[ans]=1; } answer(S,D); } // signed main(){ // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // }
#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...