제출 #572064

#제출 시각아이디문제언어결과실행 시간메모리
572064il9콤보 (IOI18_combo)C++14
100 / 100
31 ms584 KiB
//coding template #include "combo.h" #include <bits/stdc++.h> using ll =long long; using namespace std; string guess_sequence(int n) { string s; char f; long long temp=0; temp=press("XY"); string no; if(temp==2) { f='X'; no="YBA"; }else if(temp==1) { temp=press("X"); if(temp) { f='X'; no="YBA"; }else { f='Y'; no="XBA"; } }else { temp=press("B"); if(temp) { f='B'; no="XYA"; }else { f='A'; no="YXB"; } } s=f; for(int i=0;i<n-2;i++) { temp=press(s+no[0]+s+no[1]+no[0]+s+no[1]+no[1]+s+no[1]+no[2]); if(temp==s.size()+1) { s+=no[0]; }else if(temp==s.size()) { s+=no[2]; }else if(temp==s.size()+2) { s+=no[1]; } } if(n>1) { temp=press(s+no[0]+s+no[1]); if(temp==s.size()) { s+=no[2]; }else { temp=press(s+no[0]); if(temp==s.size()+1) { s+=no[0]; }else { s+=no[1]; } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:50:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         if(temp==s.size()+1)
      |            ~~~~^~~~~~~~~~~~
combo.cpp:53:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         }else if(temp==s.size())
      |                  ~~~~^~~~~~~~~~
combo.cpp:56:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         }else if(temp==s.size()+2)
      |                  ~~~~^~~~~~~~~~~~
combo.cpp:64:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         if(temp==s.size())
      |            ~~~~^~~~~~~~~~
combo.cpp:70:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |             if(temp==s.size()+1)
      |                ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...