제출 #1110387

#제출 시각아이디문제언어결과실행 시간메모리
1110387SonicML콤보 (IOI18_combo)C++14
0 / 100
1 ms508 KiB
#include "combo.h" #include <string> using namespace std; string s, all = {'A', 'B', 'X', 'Y'}; char findChar() { if(press(s + "AB") == s.size()) { if(press(s +"X") == s.size()) { return 'Y'; } return 'X'; }else { if(press(s + "A") == s.size()) { return 'B'; } return 'A'; } } std::string guess_sequence(int n) { char first = findChar(); s.push_back(first); string choice; for(int i = 0;i < all.size();i++) { if(all[i] != first) { choice.push_back(all[i]); } } for(int i = 2;i < n;i++) { string p; p = s; p.push_back(choice[0]); for(int i = 0;i < choice.size();i++) { p = p + s; p.push_back(choice[1]); p.push_back(choice[i]); } int temp = press(p); if(temp == i) { s.push_back(choice[0]); } else if(temp == i+1) { s.push_back(choice[1]); } else { s.push_back(choice[2]); } } if(n > 1) { s.push_back(findChar()); } return s; }

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

combo.cpp: In function 'char findChar()':
combo.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   if(press(s + "AB") == s.size()) {
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     if(press(s +"X") == s.size()) {
      |        ~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if(press(s + "A") == s.size()) {
      |        ~~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i = 0;i < all.size();i++) {
      |                 ~~^~~~~~~~~~~~
combo.cpp:36:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i = 0;i < choice.size();i++) {
      |                   ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...