제출 #1174076

#제출 시각아이디문제언어결과실행 시간메모리
1174076wpdmd76콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(v) v.begin(), v.end() string guess_sequence(int N){ string a[4] = {"A", "B", "X", "Y"}; string res = ""; int ix; for(int i = 0; i < 3; i++){ if(press(a[i])){ res = a[i]; ix = i; break; } } if(res == ""){ res = a[3]; ix = 3; } while(res.size() != N - 1){ string tmp = ""; tmp += res + a[(ix + 1) % 4] + a[(ix + 1) % 4]; tmp += res + a[(ix + 1) % 4] + a[(ix + 2) % 4]; tmp += res + a[(ix + 1) % 4] + a[(ix + 3) % 4]; tmp += res + a[(ix + 2) % 4]; int x = press(tmp); if(x == res.size()) res += a[(ix + 3) % 4]; else if(x == res.size() + 1) res += a[(ix + 2) % 4]; else res += a[(ix + 1) % 4]; } int cnt = 0; for(int i = 0; i < 4; i++){ if(ix == i) continue; if(cnt == 2) break; if(press(res + a[i]) == N){ return res + a[i]; } cnt++; } if(ix == 3) return res + a[2]; else return res + a[3]; return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:12: error: 'press' was not declared in this scope; did you mean 'res'?
   12 |         if(press(a[i])){
      |            ^~~~~
      |            res
combo.cpp:29:17: error: 'press' was not declared in this scope; did you mean 'res'?
   29 |         int x = press(tmp);
      |                 ^~~~~
      |                 res
combo.cpp:38:12: error: 'press' was not declared in this scope; did you mean 'res'?
   38 |         if(press(res + a[i]) == N){
      |            ^~~~~
      |            res