제출 #868043

#제출 시각아이디문제언어결과실행 시간메모리
868043TAhmed33Flight to the Ford (BOI22_communication)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <communication.h> using namespace std; vector <string> arr = { "1010", "1001", "0101", "0100", "0010", "0001", "0000" }; map <string, vector <int>> x = {{0000, {1}},{0001, {1}},{0010, {1}},{0100, {1}},{0101, {1, 2, 3}},{0110, {2, 3}},{1000, {2, 3}},{1001, {1, 2, 3}},{1010, {1}},{1100, {2, 3}},{1101, {2, 3}},{1110, {2, 3}}}; void encode (int n, int x) { if (x == 1) { send(0); send(0); send(0); send(0); } else if (x == 2) { send(0); send(0); send(1); send(0); } else { send(1); send(1); send(0); send(0); } } pair <int, int> decode (int n) { string s; for (int i = 0; i < 4; i++) s += (char)(receive() + '0'); if (x[s].size() == 1) { return {x[s].front(), x[s].front()}; } else { return {x[s].front(), x[s].back()}; } } /* 0000 1100 0010 */

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

communication.cpp:13:203: error: could not convert '{{0, {1}}, {1, {1}}, {8, {1}}, {64, {1}}, {65, {1, 2, 3}}, {72, {2, 3}}, {1000, {2, 3}}, {1001, {1, 2, 3}}, {1010, {1}}, {1100, {2, 3}}, {1101, {2, 3}}, {1110, {2, 3}}}' from '<brace-enclosed initializer list>' to 'std::map<std::__cxx11::basic_string<char>, std::vector<int> >'
   13 | map <string, vector <int>> x = {{0000, {1}},{0001, {1}},{0010, {1}},{0100, {1}},{0101, {1, 2, 3}},{0110, {2, 3}},{1000, {2, 3}},{1001, {1, 2, 3}},{1010, {1}},{1100, {2, 3}},{1101, {2, 3}},{1110, {2, 3}}};
      |                                                                                                                                                                                                           ^
      |                                                                                                                                                                                                           |
      |                                                                                                                                                                                                           <brace-enclosed initializer list>