Submission #816921

# Submission time Handle Problem Language Result Execution time Memory
816921 2023-08-09T07:31:31 Z penguinman Bit Shift Registers (IOI21_registers) C++17
58 / 100
1 ms 300 KB
#include "registers.h"

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::endl;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;

#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define all(a) a.begin(), a.end()
#define pb emplace_back
#define mp std::make_pair

constexpr ll inf = (1ll<<60);



void construct_instructions(int s, int n, int k, int q) {
	constexpr ll base = 90, allone = 91;
	constexpr ll mb = 2000;
	{
		vector<bool> v(mb);
		rep(i,1,mb){
			if(i%k == 0) v[i] = 1;
		}
		append_store(base,v);
	}
	{
		vector<bool> v(mb);
		rep(i,n*k,mb){
			v[i] = 1;
		}
		append_store(allone,v);
		append_or(0,0,allone);
	}
	while(n > 1){
		ll half = n/2;
		append_right(1, 0, half*k);

		append_print(0);
		append_print(1);

		append_not(2,1);
		append_add(3,0,2);
		append_xor(4,0,1);
		append_xor(5,3,4);
		append_and(6,base,5);

		ll lk = 1;
		while(lk < k) lk *= 2;
		if(lk != k){
			lk /= 2;
			append_right(7,6,k-lk);
			append_or(6,6,7);
		}
		while(lk > 1){
			append_right(7,6,lk/2);
			append_or(6,6,7);
			lk /= 2;
		}

		/*append_left(7,6,2);
		append_or(6,6,7);
		append_left(7,6,4);
		append_or(6,6,7);
		append_left(7,6,2);
		append_or(6,6,7);
		append_left(7,6,1);
		append_or(6,6,7);*/

		append_right(6,6,1);
		append_and(7,0,6);

		append_print(6);

		append_not(6,6);

		append_print(6);

		append_and(8,1,6);

		append_print(7);
		append_print(8);
		
		append_or(0,7,8);
		n = (n+1)/2;
	}
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Incorrect sorting
2 Halted 0 ms 0 KB -