제출 #483578

#제출 시각아이디문제언어결과실행 시간메모리
483578_Body콤보 (IOI18_combo)C++17
100 / 100
32 ms592 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string in=""; int f=press("AB"); if(f>=1) { if(press("A")>=1) in="A"; else in="B"; } else { if(press("X")) in="X"; else in="Y"; } char cc[4]={'X','Y','A','B'}; vector<char>chars; for(int i=0;i<4;i++) if(in.compare(string(1,cc[i]))!=0){ // cout<<in.compare(to_string(cc[i]))<<" "<<to_string(cc[i])<<endl; chars.push_back(cc[i]); } //for(char ccc:chars) // cout<<ccc<<endl; //cout<<in<<endl; string S=in; while(S.size()!=N) { if(S.size()==N-1) { f=press(S+chars[0]); if(f==N) { S+=chars[0]; } else { f=press(S+chars[1]+chars[2]); if(f==N) { S+=chars[1]; } else S+=chars[2]; } break; } f=press(S+chars[0]+S+chars[1]+chars[2]+S+chars[1]+chars[0]+S+chars[1]+chars[1]); //cout<<(S+chars[0]+S+chars[1]+chars[2]+S+chars[1]+chars[0]+S+chars[1]+chars[1])<<endl; // cout<<f<<" "<<S.size()<<endl; if(f==S.size()+1){ // cout<<"F"<<endl; S+=chars[0]; } else if(f==S.size()+2){ // cout<<"F"<<endl; S+=chars[1]; } else{ //cout<<"FUCK"<<endl; S+=chars[2]; }} //cout<<S<<endl; return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 | while(S.size()!=N)
      |       ~~~~~~~~^~~
combo.cpp:33:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     if(S.size()==N-1)
      |        ~~~~~~~~^~~~~
combo.cpp:55:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     if(f==S.size()+1){
      |        ~^~~~~~~~~~~~
combo.cpp:59:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |     else if(f==S.size()+2){
      |             ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...