Submission #1262758

#TimeUsernameProblemLanguageResultExecution timeMemory
1262758ByeWorldBit Shift Registers (IOI21_registers)C++20
22 / 100
1 ms744 KiB
#include "registers.h"
#include <bits/stdc++.h>
#define pb push_back
#define se second
#define fi first
using namespace std;

int c;
// 1 2 4 8
void mlog(){
	++c; append_right(c,c-1,1);  
	append_or(c-1,c-1,c);

	append_right(c,c-1,2);  
	append_or(c-1,c-1,c);

	append_right(c,c-1,4);  
	append_or(c-1,c-1,c);

	append_right(c,c-1,8);  
	append_or(c-1,c-1,c);
	c--;
}
void mn(int x, int y){
	++c; append_xor(c,c,c);
	append_xor(c,x,y); // xor

	mlog();
	// append_print(c);

	++c; append_xor(c,c,c);
	append_right(c,c-1,1);
	++c; append_xor(c,c,c);
	append_xor(c,c-2,c-1); // cmn isolate 1 bit
	// append_print(c);

	++c; append_xor(c,c,c);
	append_and(c,x,c-1); // 000 ato 0100, ngikutin x

	mlog(); // 0111

	// append_print(c);

	++c; append_not(c,c-1); // inversenya
	++c; append_and(c,x,c-1);
	++c; append_and(c,y,c-3);

	append_add(1,c,c-1);
	// append_print(1);
}
void construct_instructions(int s, int n, int k, int q) {
	
	append_move(1, 0);
	append_left(1,1,2000-k);
	append_right(1,1,2000-k);


	for(int i=2; i<=n; i++){
		c = 2;
		append_move(2, 0);
		append_left(2,2,2000-i*k);
		append_right(2,2,2000-k);
		// append_print(2);

		mn(1,2);
		// append_print(1);
	}

	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...