제출 #870484

#제출 시각아이디문제언어결과실행 시간메모리
870484AtabayRajabli동굴 (IOI13_cave)C++17
0 / 100
167 ms560 KiB
#include "cave.h" void exploreCave(int n) { int a[n], b[n], c[n], ans[n], d[n]; for(int i = 0; i<n; i++) { a[i] = 0; b[i] = 0; c[i] = 0; } int l, r, mid; for(int i = 0; i<n; i++) { l = 0, r = n-1; int q = tryCombination(b); while(l < r) { mid = (l + r) / 2; for(int i = 0; i<=mid; i++)if(!c[i])b[i] = a[i]; for(int i = mid+1; i<=r; i++)if(!c[i])b[i] = !a[i]; for(int i = r+1; i<n; i++)if(!c[i])b[i] = a[i]; int k = tryCombination(b); if((q == i && k > i) || (q > i && k == i))l = mid + 1; else r = mid; } d[i] = l; c[l] = 1; if(q > i)a[i] = a[i]; else a[i] = !a[i]; b[l] = a[i]; } answer(a, d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:4:27: warning: unused variable 'ans' [-Wunused-variable]
    4 |     int a[n], b[n], c[n], ans[n], d[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...