제출 #764676

#제출 시각아이디문제언어결과실행 시간메모리
764676hossain2020앨리스, 밥, 서킷 (APIO23_abc)C++17
컴파일 에러
0 ms0 KiB
#include "abc.h" // you may find the definitions useful const int OP_ZERO = 0; // f(OP_ZERO, x0, x1) = 0 const int OP_NOR = 1; // f(OP_NOR, x0, x1) = !(x0 || x1) const int OP_GREATER = 2; // f(OP_GREATER, x0, x1) = (x0 > x1) const int OP_NOT_X1 = 3; // f(OP_NOT_X1, x0, x1) = !x1 const int OP_LESS = 4; // f(OP_LESS, x0, x1) = (x0 < x1) const int OP_NOT_X0 = 5; // f(OP_NOT_X0, x0, x1) = !x0 const int OP_XOR = 6; // f(OP_XOR, x0, x1) = (x0 ^ x1) const int OP_NAND = 7; // f(OP_NAND, x0, x1) = !(x0 && x1) const int OP_AND = 8; // f(OP_AND, x0, x1) = (x0 && x1) const int OP_EQUAL = 9; // f(OP_EQUAL, x0, x1) = (x0 == x1) const int OP_X0 = 10; // f(OP_X0, x0, x1) = x0 const int OP_GEQ = 11; // f(OP_GEQ, x0, x1) = (x0 >= x1) const int OP_X1 = 12; // f(OP_X1, x0, x1) = x1 const int OP_LEQ = 13; // f(OP_LEQ, x0, x1) = (x0 <= x1) const int OP_OR = 14; // f(OP_OR, x0, x1) = (x0 || x1) const int OP_ONE = 15; // f(OP_ONE, x0, x1) = 1 // Alice int // returns la alice( /* in */ const int n, /* in */ const char names[][5], /* in */ const unsigned short numbers[], /* out */ bool outputs_alice[] ) { ll x=0,l=numbers[0]; for (int i=0;l;i++) { outputs_alice[i]=l%2; l/=2; x++; } return x; } // Bob int // returns lb bob( /* in */ const int m, /* in */ const char senders[][5], /* in */ const char recipients[][5], /* out */ bool outputs_bob[] ) { ll x=0,l=m; for (int i=0;l;i++) { outputs_alice[i]=l%2; l/=2; x++; } return x; } // Circuit int // returns l circuit( /* in */ const int la, /* in */ const int lb, /* out */ int operations[], /* out */ int operands[][2], /* out */ int outputs_circuit[][16] ) { ll n,m; for (int i=0;i<la;i++) { n+=((1&operands[i])<<i); } for (int i=la;i<la+lb;i++) { m+=((1&operands[i])<<(i-la)); } n=m*n; for(int j = 0; j < 16; ++j) outputs_circuit[0][j] = (n >> j & 1); return la+lb; }

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

abc.cpp: In function 'int alice(int, const char (*)[5], const short unsigned int*, bool*)':
abc.cpp:30:5: error: 'll' was not declared in this scope
   30 |     ll x=0,l=numbers[0];
      |     ^~
abc.cpp:31:15: error: 'l' was not declared in this scope
   31 |  for (int i=0;l;i++)
      |               ^
abc.cpp:35:9: error: 'x' was not declared in this scope
   35 |         x++;
      |         ^
abc.cpp:37:12: error: 'x' was not declared in this scope
   37 |     return x;
      |            ^
abc.cpp: In function 'int bob(int, const char (*)[5], const char (*)[5], bool*)':
abc.cpp:49:5: error: 'll' was not declared in this scope
   49 |     ll x=0,l=m;
      |     ^~
abc.cpp:50:15: error: 'l' was not declared in this scope
   50 |  for (int i=0;l;i++)
      |               ^
abc.cpp:52:6: error: 'outputs_alice' was not declared in this scope; did you mean 'outputs_bob'?
   52 |      outputs_alice[i]=l%2;
      |      ^~~~~~~~~~~~~
      |      outputs_bob
abc.cpp:54:9: error: 'x' was not declared in this scope
   54 |         x++;
      |         ^
abc.cpp:56:12: error: 'x' was not declared in this scope
   56 |     return x;
      |            ^
abc.cpp: In function 'int circuit(int, int, int*, int (*)[2], int (*)[16])':
abc.cpp:69:5: error: 'll' was not declared in this scope; did you mean 'la'?
   69 |     ll n,m;
      |     ^~
      |     la
abc.cpp:72:9: error: 'n' was not declared in this scope
   72 |         n+=((1&operands[i])<<i);
      |         ^
abc.cpp:72:15: error: invalid operands of types 'int' and 'int [2]' to binary 'operator&'
   72 |         n+=((1&operands[i])<<i);
      |              ~^~~~~~~~~~~~
      |              |           |
      |              int         int [2]
abc.cpp:76:9: error: 'm' was not declared in this scope
   76 |         m+=((1&operands[i])<<(i-la));
      |         ^
abc.cpp:76:15: error: invalid operands of types 'int' and 'int [2]' to binary 'operator&'
   76 |         m+=((1&operands[i])<<(i-la));
      |              ~^~~~~~~~~~~~
      |              |           |
      |              int         int [2]
abc.cpp:78:5: error: 'n' was not declared in this scope
   78 |     n=m*n;
      |     ^
abc.cpp:78:7: error: 'm' was not declared in this scope
   78 |     n=m*n;
      |       ^