제출 #869211

#제출 시각아이디문제언어결과실행 시간메모리
869211Ninedesu콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int st; string t="ABXY"; string guess_sequence(int N) { string p = ""; for (int i=0; i<4; i++) { p+=t[i]; int c=press(p); if(c){ st=i; break; } p=""; } for(int i=1; i<N; i++){ string q=""; int x=0; if(x==st)x++; for(int j=0; j<4; j++){ if(st==j)continue; q+=p+t[x]+t[j]; } x++; if(x==st)x++; q+=p+t[x]; x++; int c=press(q); if(c==p.size()+2)p+=q[p.size()]; else if(c==p.size()+1)p+=q[q.size()-1]; else p+=t[x]; } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:11: error: 'press' was not declared in this scope
   11 |     int c=press(p);
      |           ^~~~~
combo.cpp:30:11: error: 'press' was not declared in this scope
   30 |     int c=press(q);
      |           ^~~~~
combo.cpp:31:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(c==p.size()+2)p+=q[p.size()];
      |        ~^~~~~~~~~~~~
combo.cpp:32:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     else if(c==p.size()+1)p+=q[q.size()-1];
      |             ~^~~~~~~~~~~~