제출 #305035

#제출 시각아이디문제언어결과실행 시간메모리
305035mihai145콤보 (IOI18_combo)C++14
30 / 100
56 ms432 KiB
#include "combo.h" #include <vector> #include <set> std::string guess_sequence(int N) { std::string s = ""; ///first letter logic int coins = press("AB"); if(coins == 0) { ///first letter is X or Y coins = press("X"); if(coins == 0) s += "Y"; else s += "X"; } else { ///first letter is A or B coins = press("A"); if(coins == 0) s += "B"; else s += "A"; } std::set <char> opts; opts.insert('A'); opts.insert('B'); opts.insert('X'); opts.insert('Y'); opts.erase(s[0]); std::vector <char> optv; for(auto it : opts) optv.push_back(it); for(int pos = 2; pos <= N; pos++) { coins = press(s + optv[0] + s + optv[1]); if(coins == s.size()) s += optv[2]; else { coins = press(s + optv[0]); if(coins == s.size()) s += optv[1]; else s += optv[0]; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |             if(coins == s.size())
      |                ~~~~~~^~~~~~~~~~~
combo.cpp:49:30: 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(coins == s.size())
      |                        ~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...