제출 #268597

#제출 시각아이디문제언어결과실행 시간메모리
268597wdjpng콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; string guess_sequence(int n){ string val = "ABXY"; string cur; if(press("AB")>=1){ if(press("A")){ cur="A"; } else { cur="B"; } } else { if(press("X")){ cur="X"; } else { cur="Y"; } } string valids=""; rep(i, 4){ if(val[i]==cur[0]){continue;} valids+=val[i]; } for(int i = 1; i+1<n-1; i++){ string newCur=""; rep(i, 3){ if(i==cur[0]){continue;} newCur+=cur+valids[0]+valids[i]; } newCur+=cur+valids[1]; int coins = press(newCur); if(coins==i+2){ cur+=valids[0]; } else if(coins == i+1){ cur+=valids[1]; } else { cur=+valids[2]; } } rep(i,3){ if(i==2||(press(cur+valids[i]))){cur+=valids[i];break;} } return cur; }

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

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:13:8: error: 'press' was not declared in this scope
   13 |     if(press("AB")>=1){
      |        ^~~~~
combo.cpp:42:21: error: 'press' was not declared in this scope
   42 |         int coins = press(newCur);
      |                     ^~~~~
combo.cpp:55:19: error: 'press' was not declared in this scope
   55 |         if(i==2||(press(cur+valids[i]))){cur+=valids[i];break;}
      |                   ^~~~~