Submission #399546

#TimeUsernameProblemLanguageResultExecution timeMemory
399546mshandilyaCave (IOI13_cave)C++14
0 / 100
186 ms416 KiB
#include <bits/stdc++.h> #include "cave.h" void exploreCave(int N) { int switch_position[N], doors[N], query_switch[N]; int closed, curr_switch_pos; for(int i = 0; i<N; i++) { switch_position[i] = 0; query_switch[i] = 0; doors[i] = -1; } for(int i = 0, beg = 0, end = N-1; i<N; i++, beg = 0, end = N-1) { closed = tryCombination(switch_position); if(closed!=i) curr_switch_pos = 0; else curr_switch_pos = 1; for(int mid = (N-1)/2; beg<end;) { for(int j = beg; j<=mid; j++) if(doors[j]==-1) query_switch[j] = 1 - curr_switch_pos; for(int j = mid+1; j<=end; j++) if(doors[j]==-1) query_switch[j] = curr_switch_pos; closed = tryCombination(query_switch); for(int j = beg; j<=mid; j++) if(doors[j]==-1) query_switch[j] = 0; for(int j = mid+1; j<=end; j++) if(doors[j]==-1) query_switch[j] = 0; if(closed==i) end = mid; else beg = mid+1; } doors[beg] = i; switch_position[beg] = curr_switch_pos; query_switch[beg] = curr_switch_pos; } answer(switch_position, doors); }
#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...