Submission #96274

#TimeUsernameProblemLanguageResultExecution timeMemory
96274figter001Cave (IOI13_cave)C++14
100 / 100
590 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 5010; int s[maxn],d[maxn],f[maxn]; void exploreCave(int n){ for(int i=0;i<n;i++)f[i] = -1; for(int i=0;i<n;i++){ for(int j=0;j<n;j++)if(f[j] == -1)s[j] = 0; int to = tryCombination(s); bool ri = 0; if(to == i)ri = 1; for(int j=0;j<n;j++)if(f[j] == -1)s[j] = !ri; int md,lo=0,hi=n-1,at=-1; while(lo <= hi){ md = (lo+hi)/2; for(int j=lo;j<=md;j++)if(f[j] == -1)s[j] = ri; to = tryCombination(s); for(int j=lo;j<=md;j++)if(f[j] == -1)s[j] = !ri; if(to == i){ lo = md+1; }else{ hi = md-1; at = md; } } f[at] = 0; d[at] = i; s[at] = ri; } 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...