제출 #1168629

#제출 시각아이디문제언어결과실행 시간메모리
1168629SmuggingSpun레지스터 (IOI21_registers)C++20
21 / 100
1 ms328 KiB
#include "registers.h"
#include<bits/stdc++.h>
using namespace std;
const int LIM = 2000;
void construct_instructions(int s, int n, int k, int q){
    auto get_bit = [&] (int destination, int from, int i){
        append_left(destination, from, LIM - i - 1);
        append_right(destination, destination, LIM - 1);
    };
    if(s == 0 && n == 2 && k <= 2){
        if(k == 1){
            append_right(1, 0, 1);
            append_left(0, 0, LIM - 1);
            append_right(0, 0, LIM - 1);
            append_and(0, 0, 1);
            return;
        }
        if(q == 1000){
            get_bit(3, 0, 0);
            get_bit(1, 0, 1);
            get_bit(4, 0, 2);
            append_right(2, 0, 3);
            append_xor(5, 1, 2);
            append_not(5, 5);
            append_not(6, 2);
            append_and(6, 1, 6);
            append_not(7, 4);
            append_and(7, 3, 7);
            append_and(7, 5, 7);
            append_or(6, 7, 6);
            append_and(2, 2, 6);
            append_and(4, 4, 6);
            append_not(6, 6);
            append_and(1, 1, 6);
            append_and(3, 3, 6);
            append_left(0, 1, 1);
            append_left(2, 2, 1);
            append_add(0, 0, 2);
            append_add(0, 0, 3);
            append_add(0, 0, 4);
        }
        else{
            get_bit(1, 0, 0);
            get_bit(2, 0, 1);
            get_bit(3, 0, 2);
            append_right(4, 0, 3);
            append_and(5, 2, 4);
            append_xor(2, 5, 2);
            append_or(1, 1, 2);
            append_xor(4, 5, 4);
            append_or(3, 3, 4);
            append_and(0, 1, 3);
            append_left(5, 5, 1);
            append_add(0, 0, 5);
        }
        return;
    }
    const int TEMP[10] = {90, 91, 92, 93, 94, 95, 96, 97, 98, 99};
    vector<bool>k_1_first(LIM, false);
    for(int i = 0; i < k; i++){
        k_1_first[i] = true;
    }
    append_store(TEMP[9], k_1_first);
    auto get_min = [&] (int x, int y){
        append_not(TEMP[0], y);
        append_add(TEMP[0], x, TEMP[0]);
        append_right(TEMP[1], TEMP[0], 32);
        append_left(TEMP[2], TEMP[1], 32);
        append_or(TEMP[1], TEMP[1], TEMP[2]);
        append_and(TEMP[0], TEMP[0], TEMP[1]);
        append_add(y, y, TEMP[0]);
    };
    if(s == 0){
        for(int i = 1; i < n; i++){
            append_and(i, 0, TEMP[9]);
            append_right(0, 0, k);
        }
        for(int i = 1; i < n; i++){
            get_min(i, 0);
        }
        return;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...