제출 #115385

#제출 시각아이디문제언어결과실행 시간메모리
115385kitoha콤보 (IOI18_combo)C++14
5 / 100
3 ms200 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; char key[] = { 'A','B','X','Y' }; string guess_sequence(int N) { string s = ""; char element[3]; int pos = 0; int idx = 0; if (press("AB") >= 1) { if (press("A") >= 1) s = "A", idx = 0; else s = "B", idx = 1; } else { if (press("XY") >= 1) { if (press("X") >= 1) s="X", idx = 2; else s="Y", idx = 3; } } for (int i = 0; i <= 3; i++) { if (idx == i) continue; element[pos++] = key[i]; } for (int i = 1; i < N-1; i++) { string p = s + element[0] + element[0] + s + element[0] + element[1] + s + element[0] + element[2] + s + element[1]; int cnt = press(p); if (cnt == s.size() + 2) s = s + element[0]; else if (cnt == s.size() + 1) s = s + element[1]; else s = s + element[2]; } if (press(s + element[0])==s.size()+1) s += element[0]; else if (press(s + element[1])==s.size()+1) s += element[1]; else s += element[2]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if (cnt == s.size() + 2) s = s + element[0];
      |       ~~~~^~~~~~~~~~~~~~~
combo.cpp:33:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   else if (cnt == s.size() + 1) s = s + element[1];
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:37:27: 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 (press(s + element[0])==s.size()+1) s += element[0];
      |      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:38:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  else if (press(s + element[1])==s.size()+1) s += element[1];
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...