Submission #439632

#TimeUsernameProblemLanguageResultExecution timeMemory
439632cheehengBit Shift Registers (IOI21_registers)C++17
10 / 100
1 ms332 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 && n == 2);
    const int b = 2000;

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

	append_move(12, 0);
	append_move(13, 1);

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

	append_not(3, 13);
	append_store(4, one);
    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_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...