제출 #440060

#제출 시각아이디문제언어결과실행 시간메모리
440060algorithm16레지스터 (IOI21_registers)C++17
컴파일 에러
0 ms0 KiB
#include "registers.h" #include<iostream> #include<algorithm> using namespace std; int ind=6,b=2000,a,b,ab,r=2; void is0(int x,int y,int bit,int op) { //append_left(ind,x,b-1-bit); append_right(ind,x,bit); flip(ind); if(op) append_and(y,y,ind); else append_or(y,y,ind); ind+=1; } void flip(int x) { append_not(x,x); append_left(x,x,b-1); append_right(x,x,b-1); } void construct_instructions(int s,int n,int k,int q) { if(k==1) { append_move(1,0); append_right(1,1,1); append_and(0,0,1); return; } append_move(1,0); append_right(1,1,2); append_and(2,0,1); // 3 4 5 is0(2,3,1,0); is0(2,3,0,1); is0(0,4,1,0); is0(0,4,0,1); flip(4); is0(1,5,1,0); is0(1,5,0,1); flip(5); append_and(3,3,4); append_and(3,3,5); append_add(2,2,3); append_move(0,2); return; }

컴파일 시 표준 에러 (stderr) 메시지

registers.cpp:5:20: error: redefinition of 'int b'
    5 | int ind=6,b=2000,a,b,ab,r=2;
      |                    ^
registers.cpp:5:11: note: 'int b' previously defined here
    5 | int ind=6,b=2000,a,b,ab,r=2;
      |           ^
registers.cpp: In function 'void is0(int, int, int, int)':
registers.cpp:9:2: error: 'flip' was not declared in this scope
    9 |  flip(ind);
      |  ^~~~