Submission #566819

#TimeUsernameProblemLanguageResultExecution timeMemory
566819RedhoodBit Shift Registers (IOI21_registers)C++17
33 / 100
4 ms852 KiB
#include <bits/stdc++.h>

using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;

#include "registers.h"

void construct_instructions(int s, int n, int k, int q) {
	append_move(1 , 0);
	vector < bool > empt(2000), one(2000);
        for(int t=0;t<k;++t)
            empt[t]=1;
    one[0] = 1;
	for(int i = 1; i < n; ++i){
        append_move(2 , 0);
        append_right(2 , 2 , k * i);
        append_store(3 , empt);
        append_and(1 , 1 , 3);
        append_and(2 , 2 , 3);
        /// a, b
        append_move(3 , 2);
        /// a, b , b
        append_not(3 , 3);
        append_store(4 , one);
        append_print(3);
        append_add(3 , 3 , 4);
        append_add(3 , 3 , 1);
        /// in 3 we have a-b
        /// if (a - b) > 0 then by this op we will have zeros otherwise ones
        append_move(1 , 3);
        append_right(3 , 3 , k);
        /// if there are zeros than a - b > 0 then b is the option
        /// otherwise a is option and a - b < 0 a-b + b = a
        append_and(1 , 1 , 3);
        append_add(1 , 1 , 2);
	}
	append_store(2 , empt);
	append_and(1 , 1 , 2);
	append_move(0 , 1);
}

#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...
#Verdict Execution timeMemoryGrader output
Fetching results...