Submission #902364

# Submission time Handle Problem Language Result Execution time Memory
902364 2024-01-10T10:09:12 Z abcvuitunggio Bit Shift Registers (IOI21_registers) C++17
46 / 100
1 ms 500 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
const int b=2000;
int k;
void minimize(){
    append_not(3,1);
    append_add(3,2,3);
    append_right(3,3,k);
    append_not(4,3);
    append_and(3,3,2);
    append_and(4,4,1);
    append_add(2,3,4);
}
void bubble(int i){
    append_move(2,i+5);
    append_move(1,i+6);
    minimize();
    append_add(1,i+5,i+6);
    append_move(i+5,2);
    append_not(2,2);
    append_add(1,1,2);
    append_add(i+6,1,98);
}
void construct_instructions(int s, int n, int k, int q){
    ::k=k;
    if (!s){
        append_move(2,0);
        append_left(2,2,b-k);
        append_right(2,2,b-k);
        for (int i=1;i<n;i++){
            append_move(1,0);
            append_left(1,1,b-k*(i+1));
            append_right(1,1,b-k);
            minimize();
        }
        append_move(0,2);
        return;
    }
    vector <bool> v(2000,0);
    v[0]=1;
    append_store(98,v);
    for (int i=0;i<n;i++){
        append_move(i+5,0);
        append_left(i+5,i+5,b-k*(i+1));
        append_right(i+5,i+5,b-k);
    }
    for (int i=n-1;i;i--)
        for (int j=0;j<i;j++)
            bubble(j);
    append_move(0,99);
    for (int i=0;i<n;i++){
        append_left(i+5,i+5,k*i);
        append_add(0,0,i+5);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 500 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -