Submission #167427

#TimeUsernameProblemLanguageResultExecution timeMemory
167427nikatamlianiCave (IOI13_cave)C++14
0 / 100
538 ms512 KiB
# include "cave.h" # include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int x[N], y[N], fixed[N], ans[N]; for(int i = 0; i < N; i ++)fixed[i] = -1; for(int i = 0; i < N; i ++)x[i] = 0; for(int i = 0; i < N; i ++){ int l = 0, r = N - 1; int cur_x[N], res = 0; bool open; for(int j = 0; j < N; j ++)if(fixed[j] == -1)cur_x[j] = 1; else cur_x[j] = fixed[j]; if(tryCombination(cur_x) > i) open = 1; else open = 0; bool ok = false; while(l <= r){ if(l == r && ok == true) break; if(l == r)ok = true; int m = (l + r) >> 1; for(int j = l; j <= m; j ++) if(fixed[j] == -1) cur_x[j] = open; else cur_x[j] = fixed[j]; for(int j = 0; j < N; j ++) if(j < l || j > r){if(fixed[j] == -1) cur_x[j] = open ^ 1; else cur_x[j] = fixed[j];} if(tryCombination(cur_x) > i){ r = m; }else{ l = m + 1; } } res = l; ans[res] = i; fixed[res] = open; } answer(fixed, ans); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:5:6: warning: variable 'x' set but not used [-Wunused-but-set-variable]
  int x[N], y[N], fixed[N], ans[N];
      ^
cave.cpp:5:12: warning: unused variable 'y' [-Wunused-variable]
  int x[N], y[N], fixed[N], ans[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...