제출 #537148

#제출 시각아이디문제언어결과실행 시간메모리
537148andrei_boaca콤보 (IOI18_combo)C++14
100 / 100
27 ms700 KiB
#include <bits/stdc++.h> #include "combo.h" //#include "grader.cpp" using namespace std; string guess_sequence(int n) { string sol; int nr; nr=press("AB"); if(nr>=1) { nr=press("A"); if(nr==1) sol.push_back('A'); else sol.push_back('B'); } else { nr=press("X"); if(nr==1) sol.push_back('X'); else sol.push_back('Y'); } if(n==1) return sol; vector<char> vals; for(char c:{'A','B','X','Y'}) if(c!=sol[0]) vals.push_back(c); for(int i=2;i<n;i++) { string p=sol+vals[0]+sol+vals[1]+vals[1]+sol+vals[1]+vals[2]+sol+vals[1]+vals[0]; nr=press(p); if(nr==sol.size()) sol.push_back(vals[2]); else if(nr==sol.size()+2) sol.push_back(vals[1]); else sol.push_back(vals[0]); } string p=sol+vals[0]+sol+vals[1]; nr=press(p); if(nr==sol.size()) sol.push_back(vals[2]); else { p=sol+vals[0]; nr=press(p); if(nr==sol.size()+1) sol.push_back(vals[0]); else sol.push_back(vals[1]); } return sol; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         if(nr==sol.size())
      |            ~~^~~~~~~~~~~~
combo.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         else if(nr==sol.size()+2)
      |                 ~~^~~~~~~~~~~~~~
combo.cpp:46:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     if(nr==sol.size())
      |        ~~^~~~~~~~~~~~
combo.cpp:52:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         if(nr==sol.size()+1)
      |            ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...