제출 #414072

#제출 시각아이디문제언어결과실행 시간메모리
414072arneves콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define f first #define s second #define all(x) x.begin(), x.end() const int MOD = 1'000'000'007; const int MX = 400'005; //long double PI = 3.14159265358979323846264338327950; const string k="ABXY"; int pergunta(string s){ int ans=0; int r=press(s+k[0]+s+k[1]); if(r==s.length())ans+=2; r=press(s+k[0]+s+k[2]); if(r==s.length())ans+=1; return ans; } string guess_sequence(int N) { int id[4]; string ans; for(int i=0; i<4; i++) id[i]=i; int y=pergunta(""); ans+=k[y]; swap(id[y],id[3]); for(int i=1; i<N-1; i++){ string perg; perg+=ans+k[id[1]]; perg+=ans+k[id[2]]+k[id[0]]; perg+=ans+k[id[2]]+k[id[1]]; perg+=ans+k[id[2]]+k[id[2]]; y=press(perg); if(y==ans.length()){ ans+=k[id[0]]; }else if(y==ans.length()+1){ ans+=k[id[1]]; }else{ ans+=k[id[2]]; } } y=pergunta(ans); ans+=k[y]; return ans; }

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

combo.cpp: In function 'int pergunta(std::string)':
combo.cpp:20:11: error: 'press' was not declared in this scope
   20 |     int r=press(s+k[0]+s+k[1]);
      |           ^~~~~
combo.cpp:21:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if(r==s.length())ans+=2;
      |        ~^~~~~~~~~~~~
combo.cpp:23:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(r==s.length())ans+=1;
      |        ~^~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:11: error: 'press' was not declared in this scope
   40 |         y=press(perg);
      |           ^~~~~
combo.cpp:41:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if(y==ans.length()){
      |            ~^~~~~~~~~~~~~~
combo.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         }else if(y==ans.length()+1){
      |                  ~^~~~~~~~~~~~~~~~