답안 #1060780

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060780 2024-08-15T22:35:09 Z jamjanek 레지스터 (IOI21_registers) C++17
10 / 100
1 ms 764 KB
#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
	int	iterator = 0;
	vector<bool>jeden(2000, 0);jeden[0] = 1;iterator++;append_store(2, jeden);
	
	iterator++;append_right(99,0,k);
	iterator++;append_left(0, 0, 2000-k), iterator++;append_right(0, 0, 2000-k);
	for(int pow = 0;pow<n-1;pow++){
	//	znajdz 1 rozniaca sie pozycje;
		
		iterator++;append_move(1, 99);//ustaw b
		iterator++;append_left(1, 1, 2000-k), iterator++;append_right(1, 1, 2000-k);

		iterator++;append_print(0), iterator++;append_print(1);
		
		iterator++;append_and(4, 98, 4);
		iterator++;append_and(3, 98, 3);
		
		//0 - a
		//1 - b
		//2 - "1"
		//3 - czy_znaleziono_pozcje
		//4 ktora wieksza
		int i;
		for(i=k-1;i>=0;i--){
			iterator++;append_right(5, 0, i);
			iterator++;append_right(6, 1, i);
			iterator++;append_and(5, 5, 2);//i-ty bit a
			iterator++;append_and(6, 6, 2);//i-ty bit b
			iterator++;append_xor(7, 5, 6);//xor
			iterator++;append_xor(8, 3, 2); // !4
			iterator++;append_and(8, 8, 7), iterator++;append_and(8, 8, 5); 
			iterator++;append_add(4, 4, 8);
			// 1 - jesli b<a
			//3 = (!4) & 7 & 5
			
			iterator++;append_or(3, 3, 7);//czy_znaleziono_poprawione
		}
		iterator++;append_print(3);
		iterator++;append_print(4);
		//3 same 0 jeśli a<b, same 1, jeśli b<a
		iterator++;append_move(3, 4);
		for(i=1;i<k;i++){
			iterator++;append_left(3,3,1);
			iterator++;append_or(3, 3, 4);
		}

		iterator++;append_and(4, 0, 3);
		iterator++;append_xor(4, 4, 0); //a^(a&1111)
		iterator++;append_and(5, 1, 3); //b&1111
		iterator++;append_or(0, 4, 5);
		//a^(a&1111)    |    b&1111
		iterator++;append_right(99, 99, k);
	}
	assert(iterator<=q);
	return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 764 KB Wrong answer detected in grader
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 604 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 604 KB Incorrect sorting
2 Halted 0 ms 0 KB -