Submission #1320182

#TimeUsernameProblemLanguageResultExecution timeMemory
1320182yessimkhanCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> // solved by bekagg #define ll long long #define ent '\n' #define pb push_back #define all(x) x.begin(),x.end() #define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const int N = 5e5+5; const int MOD = 1e9+7; int d[N] , cnt , us[N] , s[N] , p; void build(int tl , int tr){ for (int i = tl; i <= tr; i++){ if (us[i]) continue; s[i] = 1 - s[i]; } int pos = tryCombination(s); if (pos == -1) pos = n; int tm = (tl + tr) / 2; if (pos == p){ return; } else { if (tl == tr){ us[tl] = 1; s[tl] = 1 - s[tl]; cnt++; } else { build(tl , tm) , build(tm + 1 , tr); } } } void exploreCave(int n){ while(cnt < n){ p = tryCombination(s); if (p == -1) p = n; build(0 , n - 1); } for (int i = 0; i < n; i++){ s[i] = 1 - s[i]; int pos = tryCombination(s); d[i] = pos; s[i] = 1 - s[i]; } answer(s , d); }

Compilation message (stderr)

cave.cpp: In function 'void build(int, int)':
cave.cpp:26:26: error: 'n' was not declared in this scope
   26 |     if (pos == -1) pos = n;
      |                          ^