제출 #587820

#제출 시각아이디문제언어결과실행 시간메모리
587820IvanJ콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> #define all(a) (a).begin(), (a).end() using namespace std; string guess_sequence(int n) { string p = "", s = ""; if(press("A")) s = "A"; else if(press("B")) s = "B"; else if(press("X")) s = "X"; else s = "Y"; set<string> S; S.insert("A"), S.insert("B"), S.insert("X"), S.insert("Y"); S.erase(s); vector<string> v(all(S)); for(int i = 1;i < n - 1;i++) { p = s + v[0]; for(int j = 0;j < 3;j++) p += s + v[1] + v[j]; int x = press(p); if(x == (int)s.size() + 1) s += v[0]; else if(x == (int)s.size() + 2) s += v[1]; else s += v[2]; } assert(int)s.size() == (n - 1)); if(press(s + v[0]) == n) s += v[0]; else if(press(s + v[1]) == n) s += v[1]; else s += v[2]; return s; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:9: error: expected primary-expression before 'int'
   29 |  assert(int)s.size() == (n - 1));
      |         ^~~
combo.cpp:29:9: error: expected ')' before 'int'
combo.cpp:29:9: error: expected ')' before 'int'
combo.cpp:29:2: note: to match this '('
   29 |  assert(int)s.size() == (n - 1));
      |  ^~~~~~