답안 #1056913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056913 2024-08-13T12:22:10 Z user736482 레지스터 (IOI21_registers) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "registers.h"
#include "grader.cpp"
using namespace std;

vector<bool>zera,jeden4;

void minimum(int a,int b,int t){
    //append_store(t,zera);
   //   append_move(98,a);
    append_not(98,a);
    append_add(98,b,98);
    append_right(98,98,10);

    append_and(t,b,98);
    append_not(98,98);
    append_and(98,a,98);
    append_add(t,98,t);

    /*zera[0]=1;
    append_store(98,zera);
    zera[0]=0;
    append_add(98,b,98);
    append_not(98);
    append_add(98,a,98);
    append_left(98,10,98);
    append_and(t,b,98);*/
}
void minimax(int a,int b,int t1,int t2){
    //append_store(t,zera);
   //   append_move(98,a);
    append_not(98,a);
    append_add(98,b,98);
    append_right(98,98,10);

    append_and(t1,b,98);
    append_and(t2,a,98);
    append_not(98,98);
    append_and(97,b,98);
    append_and(98,a,98);
    append_add(t1,98,t1);
    append_add(t2,97,t2);

    /*zera[0]=1;
    append_store(98,zera);
    zera[0]=0;
    append_add(98,b,98);
    append_not(98);
    append_add(98,a,98);
    append_left(98,10,98);
    append_and(t,b,98);*/
}


void construct_instructions(int s, int n, int k, int q){
    for(int i=0;i<2000;i++){
        zera.push_back(0);
        jeden4.push_back(0);
        if(i<k)
            jeden4[i]=1;
    }
    append_and(1,99,1);
    //append_right(0,k,0);

    //append_move(1,0);
    append_store(99,jeden4);
    if(s==0){
    append_right(1,0,(n-1)*k);

    for(int i=n-2;i>=0;i--){
        append_right(2,0,i*k);
        append_and(2,99,2);
        minimum(1,2,3);
        append_move(1,3);
    }



    //minimum(0,1,3);
    append_move(0,1);}
    else{
        for(int i=n-1;i>=0;i--){
                append_print(0);
        append_print(1);
        if(i>0)
            append_right(i,0,i*k);
            append_and(i,99,i);
        }
        append_print(0);
        append_print(1);
        for(int i=0;i<n-1;i++){
            for(int j=0;j<n-1;j++){
                 minimax(j,j+1,95,96);
                 append_move(j,95);
                 append_move(j+1,96);
            }
        }
        for(int i=n-1;i>0;i--){
                append_print(0);
        append_print(1);
        //if(i>0)
            append_left(i,i ,i*k);
            append_add(0,0,i);
        }
        append_print(0);
        append_print(1);
    }
}

Compilation message

registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:85:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   85 |         if(i>0)
      |         ^~
registers.cpp:87:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   87 |             append_and(i,99,i);
      |             ^~~~~~~~~~
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_print(int)':
grader.cpp:(.text+0x0): multiple definition of `append_print(int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x3b0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccIF9bhc.o:registers.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_store(int, std::vector<bool, std::allocator<bool> >)':
grader.cpp:(.text+0x2a0): multiple definition of `append_store(int, std::vector<bool, std::allocator<bool> >)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x650): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_not(int, int)':
grader.cpp:(.text+0x5c0): multiple definition of `append_not(int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0xcd0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_move(int, int)':
grader.cpp:(.text+0x790): multiple definition of `append_move(int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x9f0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_or(int, int, int)':
grader.cpp:(.text+0x960): multiple definition of `append_or(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x12b0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_add(int, int, int)':
grader.cpp:(.text+0xb60): multiple definition of `append_add(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x15b0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_xor(int, int, int)':
grader.cpp:(.text+0xd60): multiple definition of `append_xor(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0xfb0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_and(int, int, int)':
grader.cpp:(.text+0xf60): multiple definition of `append_and(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x18b0): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_left(int, int, int)':
grader.cpp:(.text+0x1160): multiple definition of `append_left(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x2010): first defined here
/usr/bin/ld: /tmp/cc6NPWjb.o: in function `append_right(int, int, int)':
grader.cpp:(.text+0x1360): multiple definition of `append_right(int, int, int)'; /tmp/ccIF9bhc.o:registers.cpp:(.text+0x1bb0): first defined here
collect2: error: ld returned 1 exit status