Submission #991616

#TimeUsernameProblemLanguageResultExecution timeMemory
991616yeediotCave (IOI13_cave)C++17
0 / 100
44 ms348 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n){ int s[n], d[n], cur[n]; bool done[n]; memset(done, 0, sizeof(done)); memset(cur, 0, sizeof(cur)); for(int i=0;i<n;i++){ int pos = tryCombination(cur); bool flag = 0; if(pos > i){ flag = 1; } for(int j=0;j<n;j++){ if(!done[j]) cur[j] = !flag; } int l = 0, r = n-1; while(l < r){ int mm = l+r >> 1; for(int j=l;j<=mm;j++){ if(!done[j]) cur[j] = flag; } pos = tryCombination(cur); for(int j=l;j<=mm;j++){ if(!done[j]) cur[j] = !flag; } if(pos > i) { r = mm; } else{ l = mm+1; } } d[i] = l; s[i] = flag; done[l] = 1; } answer(d, s); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:20:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |             int mm = l+r >> 1;
      |                      ~^~
#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...