제출 #104388

#제출 시각아이디문제언어결과실행 시간메모리
104388dupreez콤보 (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { string cs = ""; int fl[4] = {}; string l[3],l2[4] = { "A","B","X","Y" }; if (press("AB")>0) { if (press("A") == 1) { cs = "A"; fl[0] = 1; } else { cs = "B"; fl[1] = 1; } } else { if (press("X")) { cs = "X"; fl[2] = 1; } else { cs = "Y"; fl[3] = 1; } } for (int i = 0, i2 = 0; i < 4; i++) { if (fl[i] == 1)continue; l[i2] = l2[i]; i2++; } while (cs.length() < N-1) { string cs2 = cs + l[1]; for (int i = 0; i < 3; i++)cs2 += cs + l[2] + l[i]; cs+=l[press(cs2)-cs.size()]; //cout << cs << endl; } if (press(cs + "A" + cs + "B")>cs.length()) { if (press(cs + "A") > cs.length())return cs + "A"; return cs + "B"; } else { if (press(cs + "X") > cs.length())return cs + "X"; return cs + "Y"; } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |  while (cs.length() < N-1) {
      |         ~~~~~~~~~~~~^~~~~
combo.cpp:28:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if (press(cs + "A" + cs + "B")>cs.length()) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   if (press(cs + "A") > cs.length())return cs + "A";
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if (press(cs + "X") > cs.length())return cs + "X";
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...