Submission #439740

#TimeUsernameProblemLanguageResultExecution timeMemory
439740cheehengBit Shift Registers (IOI21_registers)C++17
22 / 100
2 ms620 KiB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;

void construct_instructions(int s, int n, int k, int q) {
    assert(s == 0);
    const int b = 2000;

	vector<bool> k1(b);
	for(int i = 0; i < k; i ++){
        k1[i] = 1;
	}
	vector<bool> one(b);
	vector<bool> zero(b);
	one[0] = 1;
	append_store(2, k1);
	append_store(4, one);

	append_move(12, 2);

	for(int j = 0; j < n; j ++){
        append_and(13, 0, 2);
        append_right(0, 0, k);

        if(j == n){
            //append_move(0, 12);
            append_move(0, 13);
            return;
        }

        /*for(int x = 3; x < 12; x ++){
            if(x == 4){continue;}
            append_store(x, zero);
        }*/

        append_not(12, 12);
        append_not(13, 13);

        append_not(3, 13);
        append_add(5, 3, 4);
        append_add(6, 12, 5);

        append_and(7, 6, 2); // 7 stores value of number
        append_right(6, 6, k); // 6 stores which is greater

        // 8 is all one or all 0 in the size of k
        append_move(8, 6);
        for(int i = 1; i < k; i ++){
            append_left(8, 8, 1);
            append_or(8, 8, 6);
        }

        append_move(9, 7);
        append_and(9, 8, 9);
        append_not(10, 9);
        append_add(11, 10, 4);
        append_add(12, 12, 11);

        append_not(12, 12);
        append_and(12, 12, 2);
	}

    append_move(0, 12);

	return;
}
#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...