답안 #868040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
868040 2023-10-30T09:43:50 Z TAhmed33 Flight to the Ford (BOI22_communication) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include <communication.h>
using namespace std;
void encode (int n, int x) {
	for (int i = 1; i <= x; i++) send(1);
	for (int i = x + 1; i <= n; i++) send(0);
}
pair <int, int> decode (int n) {
	vector <int> u; for (int i = 0; i < 3; i++) u.push_back(receive());
	if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) {
		return {2, 3};
	}
	if (u == {0, 1, 1}) {
		return {2, 3};
	}
	if (u == {1, 0, 1}) {
		return {1, 3};
	}
	if (u == {0, 0, 0}) {
		return {1, 1};
	}
	if (u == {0, 0, 1}) {
		return {1, 1};
	}
	if (u == {1, 0, 0}) {
		return {2, 2};
	}

}

Compilation message

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:10:11: error: expected primary-expression before '{' token
   10 |  if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) {
      |           ^
communication.cpp:10:10: error: expected ')' before '{' token
   10 |  if (u == {1, 1, 1} || u == {1, 1, 0} || u == {0, 1, 0}) {
      |     ~    ^~
      |          )
communication.cpp:13:11: error: expected primary-expression before '{' token
   13 |  if (u == {0, 1, 1}) {
      |           ^
communication.cpp:13:10: error: expected ')' before '{' token
   13 |  if (u == {0, 1, 1}) {
      |     ~    ^~
      |          )
communication.cpp:16:11: error: expected primary-expression before '{' token
   16 |  if (u == {1, 0, 1}) {
      |           ^
communication.cpp:16:10: error: expected ')' before '{' token
   16 |  if (u == {1, 0, 1}) {
      |     ~    ^~
      |          )
communication.cpp:19:11: error: expected primary-expression before '{' token
   19 |  if (u == {0, 0, 0}) {
      |           ^
communication.cpp:19:10: error: expected ')' before '{' token
   19 |  if (u == {0, 0, 0}) {
      |     ~    ^~
      |          )
communication.cpp:22:11: error: expected primary-expression before '{' token
   22 |  if (u == {0, 0, 1}) {
      |           ^
communication.cpp:22:10: error: expected ')' before '{' token
   22 |  if (u == {0, 0, 1}) {
      |     ~    ^~
      |          )
communication.cpp:25:11: error: expected primary-expression before '{' token
   25 |  if (u == {1, 0, 0}) {
      |           ^
communication.cpp:25:10: error: expected ')' before '{' token
   25 |  if (u == {1, 0, 0}) {
      |     ~    ^~
      |          )
communication.cpp:9:15: warning: control reaches end of non-void function [-Wreturn-type]
    9 |  vector <int> u; for (int i = 0; i < 3; i++) u.push_back(receive());
      |               ^