제출 #736972

#제출 시각아이디문제언어결과실행 시간메모리
736972almothana05콤보 (IOI18_combo)C++14
100 / 100
31 ms544 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int menge) { string s , t = "" , cmp = ""; int x = press("AB"); if(x == 0){ x = press("X"); if(x == 0){ s += 'Y'; t = "ABX"; } else{ s += 'X'; t = "ABY"; } } else{ x = press("A"); if(x == 0){ s += 'B'; t = "AYX"; } else{ s += 'A'; t = "YBX"; } } if(menge == 1){ return s; } for(int i = 1 ; i < menge - 1 ; i++){ cmp += s; cmp += t[0]; cmp += s; cmp += t[1]; cmp += t[0]; cmp += s; cmp += t[1]; cmp += t[1]; cmp += s; cmp += t[1]; cmp += t[2]; x = press(cmp); if(x == s.size()){ s += t[2]; } else if(x == s.size() + 1){ s += t[0]; } else{ s += t[1]; } cmp = ""; } cmp += s; cmp += t[0]; cmp += s; cmp += t[1]; x = press(cmp); if(x == s.size()){ s += t[2]; } else{ cmp = s; cmp += t[0]; x = press(cmp); if(x == s.size()){ s += t[1]; } else{ s += t[0]; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     if(x == s.size()){
      |        ~~^~~~~~~~~~~
combo.cpp:52:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     else if(x == s.size() + 1){
      |             ~~^~~~~~~~~~~~~~~
combo.cpp:67:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |   if(x == s.size()){
      |      ~~^~~~~~~~~~~
combo.cpp:74:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |     if(x == s.size()){
      |        ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...