제출 #722487

#제출 시각아이디문제언어결과실행 시간메모리
722487Bobonbush콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define foreach for #define in : using namespace std; typedef long long ll; const int MODULO = 12; template<class X , class Y> bool Maximize(X &x , Y y) { if(x < y) { x = y; return true; } return false; } template<class X ,class Y> bool Minimize(X &x , Y y) { if(x > y) { x = y; return true; } return false; } template<class X ,class Y> void Add(X &x , Y y) { x += y; if(x >= MODULO) x-= MODULO; } template<class X ,class Y> void Sub(X & x , Y y) { x -= y; if(x < 0 ) x += MODULO; } char dict[] = {'A' , 'B' , 'X' , 'Y'}; string guess_sequence(int n) { set<int>lefts; for(int i = 0 ; i < 4 ; i++) { lefts.insert(i); } string p = ""; for(int i = 0 ; i < 4 ; i++ ) { p += dict[i]; if(press(p)) { p.pop_back(); continue; } p.pop_back(); lefts.erase(i); } p += dict[*lefts.begin()]; bool rights = true; int maxx = 1; while(rights) { rights = false; foreach(int index in lefts) { p += dict[index]; if(Maximize(maxx , press(p))) { rights = true; break; } p.pop_back(); } } rights = true; while(rights) { rights = false; foreach(int index in lefts) { reverse(p.begin() , p.end()); p += dict[index]; reverse(p.begin() , p.end()); if(Maximize(maxx , press(p))) { rights = true; break; } reverse(p.begin() , p.end()); p.pop_back(); reverse(p.begin() , p .end()); } } assert((int)p.size() == n); return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:53:12: error: 'press' was not declared in this scope
   53 |         if(press(p))
      |            ^~~~~
combo.cpp:70:32: error: 'press' was not declared in this scope
   70 |             if(Maximize(maxx , press(p)))
      |                                ^~~~~
combo.cpp:87:32: error: 'press' was not declared in this scope
   87 |             if(Maximize(maxx , press(p)))
      |                                ^~~~~