Submission #509982

# Submission time Handle Problem Language Result Execution time Memory
509982 2022-01-14T13:12:37 Z cig32 Bit Shift Registers (IOI21_registers) C++17
33 / 100
1 ms 460 KB
#include "registers.h"
#include <bits/stdc++.h>
using namespace std;

void construct_instructions(int s, int n, int k, int q) {
    const int b = 2000;
	//Subtask group 1: 21 points
    if(s == 0 && n == 2 && k <= 2) {
        if(k == 1) {
            append_right(1, 0, 1);
            vector<bool> oh(b);
            oh[0] = 1;
            append_store(2, oh);
            append_and(0, 0, 2);
            append_and(0, 0, 1);
            return;
        }
        else {
            append_right(1, 0, 2);
            vector<bool> oh(b);
            oh[0] = oh[1] = 1;
            append_store(2, oh);
            append_and(0, 0, 2);
            for(int i=0; i<3; i++) {
                append_move(2, 1);
                for(int j=0; j<k; j++) {
                    int tar = (i == 2 && j == k-1 ? 0 : 2);
                    append_add(tar, 0, 2);
                    append_right(tar, tar, 1);
                }
                if(i < 2) append_move(0, 2);
            }
            return;
        }
    }
    //Subtask group 2: 12 points
    vector<bool> init2(b);
    for(int i=0; i<b; i++) init2[i] = 1;
    vector<bool> init(b);
    for(int i=0; i<k; i++) init[i] = 1;
    append_store(4, init2);
    append_store(5, init);
    append_move(1, 0);
    append_and(1, 1, 5);
    append_right(0, 0, k);
    for(int i=1; i<n; i++) {
        append_move(2, 0);
        append_and(2, 2, 5);
        append_right(0, 0, k);
        append_not(3, 2);
        append_add(3, 3, 1);
        append_right(3, 3, 1999);
        append_add(3, 3, 4);
        append_and(2, 2, 3);
        append_not(3, 3);
        append_and(1, 1, 3);
        append_add(1, 1, 2);
    }
    append_move(0, 1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Incorrect sorting
2 Halted 0 ms 0 KB -