Submission #807745

# Submission time Handle Problem Language Result Execution time Memory
807745 2023-08-05T00:29:52 Z vjudge1 Bit Shift Registers (IOI21_registers) C++17
Compilation error
0 ms 0 KB
#include "registers.h"
#define move append_move
#define store append_store
#define and append_and
#define or append_or
#define xor append_xor
#define not append_not
#define left append_left
#define right append_right
#define add append_add
#define print append_print
void construct_instructions(int s, int n, int k, int q) {
    right(1,0,k);
    if(k==1) {
        return and(0,1,0);
    }
    and(2, 1, 0);
    left(3, 0, 1);
    left(4, 1, 1);
    and(5, 4, 0);
    and(6, 3, 1);
    xor(7, 6, 5);
    not(8, 2);
    and(9, 8, 7);
    left(10, 9, 1998);
    right(10, 10, 1999);
    or(0, 10, 2);
}

Compilation message

registers.cpp:4:9: error: "and" cannot be used as a macro name as it is an operator in C++
    4 | #define and append_and
      |         ^~~
registers.cpp:5:9: error: "or" cannot be used as a macro name as it is an operator in C++
    5 | #define or append_or
      |         ^~
registers.cpp:6:9: error: "xor" cannot be used as a macro name as it is an operator in C++
    6 | #define xor append_xor
      |         ^~~
registers.cpp:7:9: error: "not" cannot be used as a macro name as it is an operator in C++
    7 | #define not append_not
      |         ^~~
registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:15:19: error: expected identifier before '(' token
   15 |         return and(0,1,0);
      |                   ^
registers.cpp:15:19: error: expected ';' before '(' token
   15 |         return and(0,1,0);
      |                   ^
      |                   ;
registers.cpp:15:20: warning: left operand of comma operator has no effect [-Wunused-value]
   15 |         return and(0,1,0);
      |                    ^
registers.cpp:15:24: warning: right operand of comma operator has no effect [-Wunused-value]
   15 |         return and(0,1,0);
      |                        ^
registers.cpp:17:8: error: expected identifier before '(' token
   17 |     and(2, 1, 0);
      |        ^
registers.cpp:20:8: error: expected identifier before '(' token
   20 |     and(5, 4, 0);
      |        ^
registers.cpp:21:8: error: expected identifier before '(' token
   21 |     and(6, 3, 1);
      |        ^
registers.cpp:22:5: error: expected primary-expression before 'xor' token
   22 |     xor(7, 6, 5);
      |     ^~~
registers.cpp:22:9: warning: left operand of comma operator has no effect [-Wunused-value]
   22 |     xor(7, 6, 5);
      |         ^
registers.cpp:22:15: warning: right operand of comma operator has no effect [-Wunused-value]
   22 |     xor(7, 6, 5);
      |               ^
registers.cpp:23:9: warning: left operand of comma operator has no effect [-Wunused-value]
   23 |     not(8, 2);
      |         ^
registers.cpp:23:14: warning: right operand of comma operator has no effect [-Wunused-value]
   23 |     not(8, 2);
      |              ^
registers.cpp:24:8: error: expected identifier before '(' token
   24 |     and(9, 8, 7);
      |        ^
registers.cpp:27:5: error: expected primary-expression before 'or' token
   27 |     or(0, 10, 2);
      |     ^~
registers.cpp:27:8: warning: left operand of comma operator has no effect [-Wunused-value]
   27 |     or(0, 10, 2);
      |        ^
registers.cpp:27:15: warning: right operand of comma operator has no effect [-Wunused-value]
   27 |     or(0, 10, 2);
      |               ^