제출 #1029304

#제출 시각아이디문제언어결과실행 시간메모리
1029304Osplei콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<vii> wgraf; typedef pair<int,ii> edge; typedef vector <ll> vl; typedef pair <ll, ll> LL; typedef vector <LL> vll; #define UNVISITED 0 #define VISITED 1 #define pb push_back #define F first #define S second string guess_sequence(int N){ ll k = 0, aux; string ans = "", act; aux = press("XA"); if (aux != 0) { aux = press("X"); if (aux != 0) ans += 'X'; else ans += 'A'; } else { aux = press("B"); if (aux != 0) ans += 'B'; else ans += 'Y'; } k = 1; for (ll i = 0; i < N - 1; i++) { act = ans; if (ans[0] == 'X') { act += 'A'; act += 'A'; act += ans; act += 'A'; act += 'B'; act += ans; act += 'A'; act += 'Y'; act += ans; act += 'B'; aux = press(act); if (aux == k + 2) ans += 'A'; else if (aux == k + 1) ans += 'B'; else ans += 'Y'; } else if (ans[0] == 'A') { act += 'X'; act += 'X'; act += ans; act += 'X'; act += 'B'; act += ans; act += 'X'; act += 'Y'; act += ans; act += 'B'; aux = press(act); if (aux == k + 2) ans += 'X'; else if (aux == k + 1) ans += 'B'; else ans += 'Y'; } else if (ans[0] == 'B') { act += 'A'; act += 'A'; act += ans; act += 'A'; act += 'X'; act += ans; act += 'A'; act += 'Y'; act += ans; act += 'X'; aux = press(act); if (aux == k + 2) ans += 'A'; else if (aux == k + 1) ans += 'X'; else ans += 'Y'; } else { act += 'A'; act += 'A'; act += ans; act += 'A'; act += 'B'; act += ans; act += 'A'; act += 'X'; act += ans; act += 'B'; aux = press(act); if (aux == k + 2) ans += 'A'; else if (aux == k + 1) ans += 'B'; else ans += 'X'; } k++; } if (ans[0] == 'X'){ act = ans; act += 'A'; act += ans; act += 'B'; aux = press(act); if (aux >= N) { act = ans; act += 'A'; aux = press(act); if (aux == N) { ans += 'A'; return ans; } else { ans += 'B'; return ans; } } else { ans += 'Y'; return ans; } } else if (ans[0] == 'A'){ act = ans; act += 'X'; act += ans; act += 'B'; aux = press(act); if (aux >= N) { act = ans; act += 'X'; aux = press(act); if (aux == N) { ans += 'X'; return ans; } else { ans += 'B'; return ans; } } else { ans += 'Y'; return ans; } } else if (ans[0] == 'B'){ act = ans; act += 'A'; act += ans; act += 'X'; aux = press(act); if (aux >= N) { act = ans; act += 'A'; aux = press(act); if (aux == N) { ans += 'A'; return ans; } else { ans += 'X'; return ans; } } else { ans += 'Y'; return ans; } } else { act = ans; act += 'A'; act += ans; act += 'B'; aux = press(act); if (aux >= N) { act = ans; act += 'A'; aux = press(act); if (aux == N) { ans += 'A'; return ans; } else { ans += 'B'; return ans; } } else { ans += 'X'; return ans; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin >> t; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:9: error: 'press' was not declared in this scope
   26 |   aux = press("XA");
      |         ^~~~~
combo.cpp: In function 'int main()':
combo.cpp:226:7: warning: unused variable 't' [-Wunused-variable]
  226 |   int t = 1;
      |       ^