Submission #1067533

# Submission time Handle Problem Language Result Execution time Memory
1067533 2024-08-20T19:50:16 Z Itamar Bit Shift Registers (IOI21_registers) C++17
21 / 100
0 ms 348 KB
using namespace std;

#include <vector>
#define vb vector<bool>
const int B = 2000;
int N,K;
void append_move(int t, int x);
void append_store(int t, std::vector<bool> v);
void append_and(int t, int x, int y);
void append_or(int t, int x, int y);
void append_xor(int t, int x, int y);
void append_not(int t, int x);
void append_left(int t, int x, int s);
void append_right(int t, int x, int s);
void append_add(int t, int x, int y);
void append_print(int t);
//void construct_instructions(int s, int n, int k, int q);

void dif(int t, int a, int b, int l){
	vb v(B);v[0]=true; append_store(l,v); 
	append_not(t,b);
	append_add(t,l,t);
	append_add(t,a,t);
	append_print(t);
}
void comp(int t, int a, int b, int l){ // puts 00...0 in t if (a==b), and 1..111 else
	append_xor(l,a,b);
	append_right(l,l,1);
	vb v(B,true);
	append_store(l+1,v);
	append_add(l+2,l+1,l);
	append_right(l+3,l+2,B-1);
	append_add(t,l+1,l+3);
	//append_not(t,t);
	append_print(t);
}
void ithbit(int t, int i){
	vb v1(B);
	for(int j = i; j < N*K; j+=K){
		v1[j]=1;
	}
	append_store(t,v1);
}
void compi(int t, int a, int b, int l){
	dif(t,b,a,l);
	append_move(l+2,t);
	append_right(l+2,l+2,B-1);
	vb v(B,true); append_store(l+1,v);
	append_add(l+3,l+2,l+1);
	append_and(t,t,l+3);
	append_add(t,t,a);
	//append_print(t);
	append_xor(t,t,a);
	append_xor(t,t,b);
}
void construct_instructions(int s, int n, int k, int q) {
	N=n, K=k;
	append_move(1,0);
	append_left(0,0,B-K);
	append_right(0,0,B-K);
	append_right(1,1,K);
	compi(10,0,1,3);
	append_move(0,10);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -