Submission #1035167

# Submission time Handle Problem Language Result Execution time Memory
1035167 2024-07-26T05:27:13 Z hotboy2703 Bit Shift Registers (IOI21_registers) C++17
46 / 100
1 ms 764 KB
#include "registers.h"

#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define MASK(i) (1LL<<(i))
#define BIT(mask,i) (((mask) >> (i))&1)
const ll b = 2000;
void construct_instructions(int s, int n, int k, int q) {
	auto solve = [&](ll i,ll j){
		append_left(2,1,i*k);
		append_not(99,2);
		append_and(2,0,2);
		append_and(0,0,99);
		append_left(3,1,j*k);
		append_not(99,3);
		append_and(3,0,3);
		append_and(0,0,99);
		// get numbers
		append_right(4,2,i*k);
		append_right(5,3,j*k);
		append_not(5,5);
		// a[i] <= a[j] ???
		append_add(6,4,5);
		append_right(6,6,2000-k);
		// do sth??
		append_not(5,5);
		append_print(4);
		append_print(5);
		append_print(6);
		append_print(0);
		append_left(7,6,i*k);
		append_left(8,6,j*k);
		append_left(9,2,(j-i)*k);
		append_right(10,3,(j-i)*k);
		append_print(7);
		append_print(8);
		// 2 or 10, 3 or 9
		append_and(2,2,7);
		append_not(7,7);
		append_and(10,10,7);
		append_not(7,7);
		append_add(2,2,10);
		append_print(2);
		append_add(0,0,2);

		append_and(3,3,8);
		append_not(8,8);
		append_and(9,9,8);
		append_not(8,8);
		append_add(3,3,9);
		append_print(3);
		append_add(0,0,3);
	};
	{
		vector <bool> tmp(2000);
		for (ll j = 0;j < k;j ++)tmp[j] = 1;
		append_store(1,tmp);
	}
	if (s==0&&q==20){
		// cout<<"SUS"<<endl;
		append_left(3,1,k);
		append_and(3,0,3);
		append_xor(0,0,3);
		append_right(3,3,k);
		append_not(4,3);
		append_add(5,0,4);
		append_right(5,5,2000-k);
		append_and(0,0,5);
		append_not(5,5);
		append_and(3,3,5);
		append_add(0,0,3);
		return;
	}
	if (s){
	for (ll i = 0;i < n;i ++){
		for (ll j = i + 1;j < n;j ++){
			solve(i,j);

		}
	}
}
else for (ll i = 1;i < n;i++)solve(0,i);
	// append_move(1, 0);
	// append_right(1, 1, 1);
	// append_and(0, 0, 1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 600 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 432 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 760 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -