제출 #701019

#제출 시각아이디문제언어결과실행 시간메모리
701019BobCompetitiveProgramming콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; /* int press(string s){ cout << " IN PRESS, ans with string s = " << s << endl; ll ret; cin>>ret; return ret; } */ string guess_sequence(int N){ string S = "", first; vector<string> buttons{"A", "B", "X", "Y"}; for(auto& button : buttons) if(press(button)) first = button, S += button; while(true){ if(S.size() == N) return S; for(auto& button : buttons) if(button != first && press(S + button) > S.size()) S += button; } } /* int main(){ guess_sequence(5); } */

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:12: error: 'press' was not declared in this scope
   16 |         if(press(button))
      |            ^~~~~
combo.cpp:20:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |         if(S.size() == N)
      |            ~~~~~~~~~^~~~
combo.cpp:24:35: error: 'press' was not declared in this scope
   24 |             if(button != first && press(S + button) > S.size())
      |                                   ^~~~~