제출 #544636

#제출 시각아이디문제언어결과실행 시간메모리
544636LunaMeme콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef vector<pair<int, int>> vii; typedef vector<int> vi; typedef long long ll; #define PB push_back #define MP make_pair #define FOR(i, x, y) for (ll i = x; i < y ; i ++) #include <combo.h> string guess_sequence(int n){ string s; string l[] = {"A", "B", "X", "Y"}; string start; vector<string> m; if (press("AB")){ if (press("A")){ start ="A"; } else start = "B"; } else if (press("X")) start = "X"; else start = "Y"; s = start; FOR(i, 0, 4){ if (l[i] != start){ m.PB(l[i]); } } FOR(i, 0, n - 2){ int guess = press(s + m[0] + s + m[1] + m[0] + s + m[1] + m[1] + s + m[1] + m[2]); guess -= (i + 1); if (guess == 0){ s += m[2]; } else if (guess == 1){ s += m[0]; } else { s += m[1]; } } if (press(s + "A" + s + "B") == n){ if (press(s + "A")) s += "A"; else s += "B"; else if (press(s + "X") == n){ s += "X"; } else s += "Y"; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:46:5: error: expected '}' before 'else'
   46 |     else if (press(s + "X") == n){
      |     ^~~~
combo.cpp:43:39: note: to match this '{'
   43 |     if (press(s + "A" + s + "B") == n){
      |                                       ^
combo.cpp:52:1: warning: no return statement in function returning non-void [-Wreturn-type]
   52 | }
      | ^