Submission #101945

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1019452019-03-21 07:08:04PlurmCave (IOI13_cave)C++11
0 / 100
833 ms492 KiB
#include "cave.h"
#include <cstring>
void exploreCave(int N) {
int arr[N];
memset(arr,0,sizeof(arr));
int forced[N];
memset(forced,-1,sizeof(forced));
int conn[N];
int now[N];
for(int i = 0; i < N; i++){
if(tryCombination(arr) > i-1){
int lo = 0;
int hi = N-1;
int mid;
while(lo < hi){
mid = (lo + hi)/2;
for(int j = 0; j <= mid; j++){
now[j] = !arr[j];
if(forced[j] != -1) now[j] = forced[j];
}
for(int j = mid+1; j <= N; j++){
now[j] = arr[j];
if(forced[j] != -1) now[j] = forced[j];
}
if(tryCombination(arr) == i-1){
hi = mid;
}else{
lo = mid+1;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:9:6: warning: variable 'now' set but not used [-Wunused-but-set-variable]
  int now[N];
      ^~~
#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...