답안 #1068631

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068631 2024-08-21T11:01:53 Z alex_2008 레지스터 (IOI21_registers) C++17
컴파일 오류
0 ms 0 KB
#include "registers.h"
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define ff first
#define ss second
typedef long long ll;
using namespace std;
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;
	}
	vector <int> b(2000, 0);
	b[0] = 1;
	store(1, b);
	and (2, 0, 1);
	b[0] = 0;
	b[1] = 1;
	store(3, b);
	and (4, 0, 3);
	b[1] = 0;
	b[2] = 1;
	store(5, b);
	and (6, 0, 5);
	b[2] = 0;
	b[3] = 1;
	store(7, b);
	and (8, 0, 7);
	and (9, 4, 8);
	not(10, 9);
	xor (11, 4, 10);
	xor (12, 8, 10);
	xor (13, 1, 2);
	xor (14, 1, 6);
	and (15, 13, 11);
	and (16, 14, 12);
	or (17, 15, 16);
	xor (18, 17, 1);
	right(19, 9, 1);
	add(0, 19, 18);
}

Compilation message

registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:21:2: error: 'store' was not declared in this scope
   21 |  store(1, b);
      |  ^~~~~
registers.cpp:22:6: error: expected identifier before '(' token
   22 |  and (2, 0, 1);
      |      ^
registers.cpp:26:6: error: expected identifier before '(' token
   26 |  and (4, 0, 3);
      |      ^
registers.cpp:30:6: error: expected identifier before '(' token
   30 |  and (6, 0, 5);
      |      ^
registers.cpp:34:6: error: expected identifier before '(' token
   34 |  and (8, 0, 7);
      |      ^
registers.cpp:35:6: error: expected identifier before '(' token
   35 |  and (9, 4, 8);
      |      ^
registers.cpp:36:6: warning: left operand of comma operator has no effect [-Wunused-value]
   36 |  not(10, 9);
      |      ^~
registers.cpp:36:12: warning: right operand of comma operator has no effect [-Wunused-value]
   36 |  not(10, 9);
      |            ^
registers.cpp:37:2: error: expected primary-expression before 'xor' token
   37 |  xor (11, 4, 10);
      |  ^~~
registers.cpp:37:7: warning: left operand of comma operator has no effect [-Wunused-value]
   37 |  xor (11, 4, 10);
      |       ^~
registers.cpp:37:14: warning: right operand of comma operator has no effect [-Wunused-value]
   37 |  xor (11, 4, 10);
      |              ^~
registers.cpp:38:2: error: expected primary-expression before 'xor' token
   38 |  xor (12, 8, 10);
      |  ^~~
registers.cpp:38:7: warning: left operand of comma operator has no effect [-Wunused-value]
   38 |  xor (12, 8, 10);
      |       ^~
registers.cpp:38:14: warning: right operand of comma operator has no effect [-Wunused-value]
   38 |  xor (12, 8, 10);
      |              ^~
registers.cpp:39:2: error: expected primary-expression before 'xor' token
   39 |  xor (13, 1, 2);
      |  ^~~
registers.cpp:39:7: warning: left operand of comma operator has no effect [-Wunused-value]
   39 |  xor (13, 1, 2);
      |       ^~
registers.cpp:39:14: warning: right operand of comma operator has no effect [-Wunused-value]
   39 |  xor (13, 1, 2);
      |              ^
registers.cpp:40:2: error: expected primary-expression before 'xor' token
   40 |  xor (14, 1, 6);
      |  ^~~
registers.cpp:40:7: warning: left operand of comma operator has no effect [-Wunused-value]
   40 |  xor (14, 1, 6);
      |       ^~
registers.cpp:40:14: warning: right operand of comma operator has no effect [-Wunused-value]
   40 |  xor (14, 1, 6);
      |              ^
registers.cpp:41:6: error: expected identifier before '(' token
   41 |  and (15, 13, 11);
      |      ^
registers.cpp:42:6: error: expected identifier before '(' token
   42 |  and (16, 14, 12);
      |      ^
registers.cpp:43:2: error: expected primary-expression before 'or' token
   43 |  or (17, 15, 16);
      |  ^~
registers.cpp:43:6: warning: left operand of comma operator has no effect [-Wunused-value]
   43 |  or (17, 15, 16);
      |      ^~
registers.cpp:43:14: warning: right operand of comma operator has no effect [-Wunused-value]
   43 |  or (17, 15, 16);
      |              ^~
registers.cpp:44:2: error: expected primary-expression before 'xor' token
   44 |  xor (18, 17, 1);
      |  ^~~
registers.cpp:44:7: warning: left operand of comma operator has no effect [-Wunused-value]
   44 |  xor (18, 17, 1);
      |       ^~
registers.cpp:44:15: warning: right operand of comma operator has no effect [-Wunused-value]
   44 |  xor (18, 17, 1);
      |               ^
registers.cpp:45:8: error: invalid initialization of non-const reference of type 'std::ios_base&' from an rvalue of type 'int'
   45 |  right(19, 9, 1);
      |        ^~
In file included from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from registers.cpp:2:
/usr/include/c++/10/bits/ios_base.h:1014:19: note: in passing argument 1 of 'std::ios_base& std::right(std::ios_base&)'
 1014 |   right(ios_base& __base)
      |         ~~~~~~~~~~^~~~~~
registers.cpp:46:2: error: 'add' was not declared in this scope; did you mean 'fadd'?
   46 |  add(0, 19, 18);
      |  ^~~
      |  fadd