Submission #1037001

# Submission time Handle Problem Language Result Execution time Memory
1037001 2024-07-27T21:21:11 Z aaaaaarroz Bit Shift Registers (IOI21_registers) C++17
100 / 100
2 ms 784 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) {
    	{
    		vector <bool> tmp(b);
    		for (ll i = 0;i < b;i ++){
    			if ((i/k)%2==0)tmp[i] = 1;
    		}
    		append_store(1,tmp);
    	}
    	{
    		vector <bool> tmp(b);
    		for (ll i = n*k;i < b;i ++){
    			tmp[i] = 1;
    		}
    		append_store(3,tmp);
    	}
    	if (s==0){
    		append_or(0,0,3);
    		ll cur = 1;
    		while (cur < n){
    			append_right(4,0,cur*k);
    			append_and(4,4,1);
    			append_and(0,0,1);
    			append_not(4,4);
    			append_add(5,0,4);
    			append_not(4,4);
    			append_right(5,5,k);
    			append_and(0,0,5);
    			append_not(5,5);
    			append_and(4,4,5);
    			append_add(0,0,4);
    			cur *= 2;
    		}
    	}
    	else{
    		{
    			vector <bool> tmp(b);
    			for (ll i = 0;i < b;i ++){
    				if ((i/k)%2==1)tmp[i] = 1;
    			}
    			append_store(2,tmp);
    		}
    		for (ll i = 0;i < n;i ++){
    			bool t = i&1;
    			append_or(0,0,3);
    			append_and(4,0,t+1);
    			append_right(5,0,k);
    			append_and(5,5,t+1);
    			append_not(5,5);
    			append_add(6,4,5);
    			append_right(6,6,k);
    			append_and(6,6,t+1);
    			append_not(5,5);
    			append_print(4);
    			append_print(5);
    			append_print(6);
    			append_and(7,4,6);
    			append_not(6,6);
    			append_and(8,5,6);
    			append_not(6,6);
    			append_left(6,6,k);
    			append_left(4,4,k);
    			append_left(5,5,k);
    			append_and(9,5,6);
    			append_not(6,6);
    			append_and(10,4,6);
    			append_not(6,6);			
    			{
    				vector <bool> tmp(b);
    				if (t==1){
    					for (ll i = 0;i < k;i ++)tmp[i] = 1;
    				}
    				append_store(11,tmp);
    				append_and(0,0,11);
    			}
    			append_add(7,7,8);
    			append_add(0,0,7);
    			append_add(9,9,10);
    			append_add(0,0,9);
    		}
    	}
    }
# 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 780 KB Output is correct
4 Correct 2 ms 784 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct