Submission #1062190

# Submission time Handle Problem Language Result Execution time Memory
1062190 2024-08-16T21:02:26 Z jamjanek Bit Shift Registers (IOI21_registers) C++17
58 / 100
1 ms 348 KB
#include "registers.h"
#include<bits/stdc++.h>
using namespace std;

int iterator1;
void policz_mniejsze(int k, int skip, int n){
	vector<bool>zero(2000, 0);
	int i;
	for(i=0;i<2000;i+=k*skip*2)
		zero[i] = 1;
	append_store(10, zero);
	for(int j=0;j<n;j+=skip*2)
		for(int i=0;i<k;i++)
			zero[j*k+i] = 1;
	append_store(11, zero);
	//0 - a
	//1 - b
	//2 - !a
	append_right(1, 0, k*skip);
	append_and(0,11,0);
	append_and(1,11,1);

	append_not(2, 0);
	append_and(2, 2, 11);

	append_add(2, 1, 2);

	append_right(2, 2, k);
	append_and(2, 2, 10);//0 lub 1	


	append_add(2, 2, 11); //11111 lub 0000
	append_and(3, 1, 2);
	append_and(4, 0, 2);
	append_xor(4, 0, 4);
	append_or(2, 3, 4);
	append_xor(1, 0, 1);
	append_move(0, 2);
	append_xor(1, 0, 1);
//	append_left(1, 1, k);
//	append_or(0, 1, 0);
}

void construct_instructions(int s, int n, int k, int q) {
	vector<bool>zero(2000, 0);
	int pot = 1;
	while(pot<n)
		pot*=2;
	for(int i=k*n;i<pot*k;i++)
		zero[i] = 1;
//	for(auto j: zero)printf("%d", (int)j);printf("\n");
	n = pot;

	append_store(1, zero);

	append_or(0, 0, 1);

//	append_print(0);
	
	
	int skip = 1;
	while(skip<n){
		policz_mniejsze(k, skip, n);
		append_print(0);
		skip*=2;
	}
}
# 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 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 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 -