Submission #869099

#TimeUsernameProblemLanguageResultExecution timeMemory
869099AtabayRajabliCave (IOI13_cave)C++17
0 / 100
1 ms348 KiB
#include "cave.h" void exploreCave(int n) { int q = 0; int a[n], ans[n], d[n]; for(int i = 0; i<n; i++) { a[i] = 0; } for(int i = 0; i<n; i++) { a[i] ^= 1; int l = 0, r = n-1, q = tryCombination(a); if(q == -1)q = n; while(l < r) { int mid = (l + r) / 2; a[mid] ^= 1; int k = tryCombination(a); if(k == -1)k = n; if(k == q) { r = mid - 1; a[mid] ^= 1; } else if(k < q) { l = mid + 1; d[mid] = k; a[mid] ^= 1; } else if(k == q + 1) { d[mid] = q; break; } } } answer(a, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:4:9: warning: unused variable 'q' [-Wunused-variable]
    4 |     int q = 0;
      |         ^
cave.cpp:5:15: warning: unused variable 'ans' [-Wunused-variable]
    5 |     int a[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...