제출 #104673

#제출 시각아이디문제언어결과실행 시간메모리
104673Erkhemkhuu동굴 (IOI13_cave)C++17
0 / 100
66 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define n 5005 bool vis[n + 5]; int ind[n + 5], switches[n + 5]; void run(int l, int r, bool flag) { int i; for(i = l; i <= r; i++) if(!vis[i]) switches[i] = flag; return; } void exploreCave(int N) { memset(switches, 0, sizeof(switches)); memset(vis, false, sizeof(vis)); memset(ind, 0, sizeof(ind)); int i, l, r, mid; bool flag; for(i = 0; i < N; i++) { flag = tryCombination(switches) == i; l = 0; r = N; while(l + 1 < r) { int mid = (l + r) / 2; run(l, mid, flag); run(mid + 1, r, flag ^ 1); if(tryCombination(switches) == i) l = mid; else r = mid; } vis[i] = true; switches[i] = flag; ind[i] = l; } answer(switches, ind); return; }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:15: warning: unused variable 'mid' [-Wunused-variable]
  int i, l, r, mid;
               ^~~
#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...