제출 #1289141

#제출 시각아이디문제언어결과실행 시간메모리
1289141Isam콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; char ch[] = "ABXY"; string guess_sequence(int N) { string x = ""; x += ((press(x + "A" + x + "B") >= 1) ? ((press(x + "A") >= 1) ? "A": "B") : ((press(curr + "X") >= 1) ? "X" : "Y")); vector<char> v; for(int i = 0; i < 4; ++i) if(ch[i] ^ x[0]) v.emplace_back(ch[i]); for(int i = 1; i < N - 1; ++i){ string y = x + v[1] + x + v[2] + v[0] + x + v[2] + v[1] + x + v[2] + v[2]; int r{press(y)}; x += ((r == i) ? v[0] : ((res == i + 1) ? v[1] : v[2])); } if(N > 1) x += (press(x + "A" + x + "B") >= N) ? ((press(curr + "A") >= N) ? "A" : "B") : ((press(curr + "X") >= N) ? "X" : "Y"); return x; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:90: error: 'curr' was not declared in this scope
   10 |     x += ((press(x + "A" + x + "B") >= 1) ? ((press(x + "A") >= 1) ? "A": "B") : ((press(curr + "X") >= 1) ? "X" : "Y"));
      |                                                                                          ^~~~
combo.cpp:16:35: error: 'res' was not declared in this scope
   16 |         x += ((r == i) ? v[0] : ((res == i + 1) ? v[1] : v[2]));
      |                                   ^~~