Submission #621183

# Submission time Handle Problem Language Result Execution time Memory
621183 2022-08-03T13:40:54 Z tinjyu Bit Shift Registers (IOI21_registers) C++17
58 / 100
1 ms 336 KB
#include "registers.h"
#include <iostream>
#include <vector>
using namespace std;
void construct_instructions(int s, int n, int k, int q) {
    vector<bool> v(2000);
    for(int i=0;i<2000;i++)
    {
        v[i]=0;
    }
    long long int len=1;
    while(len<n)
    {
        len*=2;
    }
    for(int i=n;i<len;i++)
    {
        for(int j=0;j<k;j++)
        {
            v[i*k+j]=1;
        }
    }
    append_store(1,v);
    append_add(0,0,1);
    
    for(int i=0;i<2000;i++)
    {
        if((i/k)%2==0)v[i]=1;
        else v[i]=0;
    }
    append_store(2,v);
    for(int i=0;i<2000;i++)
    {
        if((i/k)%2==0)v[i]=0;
        else v[i]=1;
    }
    append_store(6,v);
    long long int rm=2;
    while(len>1)
    {
        
        append_right(1,0,k*rm/2);
        append_move(5,1);
        if(rm==2)append_and(5,5,2);
        append_not(1,1);


        if(rm==2)append_and(0,0,2);
        append_and(1,1,2);

        append_add(3,0,1);
        append_move(1,5);
        

        append_print(0);
        append_print(1);

        append_and(3,6,3);
        append_print(3);
        append_right(3,3,1);
        int tmp=1;
        while(tmp<k)
        {
            if(tmp*2<=k)
            {
                append_right(4,3,tmp);
                append_add(3,3,4);
            }
            else 
            {
                append_right(4,3,k-tmp);
                append_or(3,3,4);
            }
            tmp*=2;
        }
        append_print(0);
        append_print(1);
        append_print(3);
        append_and(1,1,3);

        append_not(3,3);
        append_and(0,0,3);
        append_add(0,0,1);
        len/=2;
        rm*=2;
    }
    return ;
}
# 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 216 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 0 ms 212 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Incorrect sorting
2 Halted 0 ms 0 KB -