Submission #62835

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
628352018-07-30 12:25:31mhndCave (IOI13_cave)C++14
100 / 100
420 ms596 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
int s[5010],d[5010],tmp[5010];
bool vis[5010];
void exploreCave(int n){
for(int i=0;i<n;i++){
int md,lo=0,hi=n-1,ans=0;
int to = tryCombination(s);
int t = (to>i || to==-1)?0:1;
while(lo!=hi){
md = (lo+hi)/2;
for(int i=lo;i<=md;i++)if(!vis[i])s[i]=!s[i];
to = tryCombination(s);
for(int i=lo;i<=md;i++)if(!vis[i])s[i]=!s[i];
int c = (to>i || to==-1)?0:1;
if(c != t)hi = md;
else lo = md+1;
}
s[lo]=t;
d[lo]=i;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:25: warning: unused variable 'ans' [-Wunused-variable]
      int md,lo=0,hi=n-1,ans=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...