Submission #437158

#TimeUsernameProblemLanguageResultExecution timeMemory
437158jeroenodbBit Shift Registers (IOI21_registers)C++17
Compilation error
0 ms0 KiB
#ifdef LOCAL #include "grader.cpp" #else #include "registers.h" #endif #include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; const int one = 99, work=97; const int full = 98,B=2000; int K; void mynegate(int t,int a) { append_not(t,a); append_add(t,t,one); } void leq(int a, int b) { mynegate(work,b); append_add(work,a,work); append_left(work-1,k,one); append_and(work,work,work-1); append_right(work,work,k); append_add(work,work,one); // work now filled with all zeroes or ones, depending on a<=b } void construct_instructions(int s, int n, int k, int q) { { // init K=k; append_not(full,full); vector<bool> v(B); v[0]=1; append_store(one,v); } assert(s==0 and n==2); append_move(1,0); append_right(1,1,k); leq(0,1); append_and(0,0,work); append_not(work,work); append_and(work-1,1,work); append_xor(0,work-1,0); }

Compilation message (stderr)

registers.cpp: In function 'void leq(int, int)':
registers.cpp:27:21: error: 'k' was not declared in this scope
   27 |  append_left(work-1,k,one);
      |                     ^