Submission #856493

# Submission time Handle Problem Language Result Execution time Memory
856493 2023-10-03T17:24:54 Z andrei_boaca Bit Shift Registers (IOI21_registers) C++17
0 / 100
1 ms 348 KB
#include "registers.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
int M=100,B=2000;
vector<bool> v(2000);
void construct_instructions(int s, int n, int k, int q)
{
    for(int bit=k-1;bit>0;bit--)
    {
        for(int i=0;i<n;i++)
            for(int j=0;j<k;j++)
            {
                v[i*k+j]=0;
                if(j==bit)
                    v[i*k+j]=1;
            }
        append_store(1,v);
        append_xor(2,0,1);
        if(bit!=0)
            append_right(2,2,bit);
        int poz=2;
        for(int lg=2;lg<=bit+1;lg*=2)
        {
            append_left(poz+1,poz,lg/2);
            append_add(poz+1,poz+1,poz);
            poz++;
        }
        int mask;
        if(bit==1)
            mask=3;
        if(bit==2)
        {
            append_left(2,2,2);
            append_add(3,3,2);
            mask=3;
        }
        if(bit==3)
            mask=4;
        if(bit==4)
        {
            append_left(2,2,4);
            append_add(4,4,2);
            mask=4;
        }
        if(bit==5)
        {
            append_left(3,3,4);
            append_add(4,3,4);
            mask=4;
        }
        if(bit==6)
        {
            append_left(3,3,4);
            append_add(4,3,4);
            append_left(2,2,6);
            append_add(4,2,4);
            mask=4;
        }
        if(bit==7)
            mask=5;
        if(bit==8)
        {
            append_left(2,2,8);
            append_add(5,5,2);
            mask=5;
        }
        if(bit==9)
        {
            append_left(3,3,8);
            append_add(5,5,3);
            mask=5;
        }
        append_or(0,0,mask);
    }
    int lg=n;
    while(lg>1)
    {
        int newlg=lg/2+lg%2;
        append_right(1,0,newlg*k);
        if(lg%2==1)
        {
            for(int i=0;i<n;i++)
                for(int j=0;j<k;j++)
                {
                    v[i*k+j]=0;
                    if(i==newlg-1)
                        v[i*k+j]=1;
                }
            append_store(3,v);
            append_add(1,1,3);
        }
        append_and(0,0,1);
        lg=newlg;
    }
}

Compilation message

registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:74:18: warning: 'mask' may be used uninitialized in this function [-Wmaybe-uninitialized]
   74 |         append_or(0,0,mask);
      |         ~~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Incorrect min value
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -