제출 #1008383

#제출 시각아이디문제언어결과실행 시간메모리
1008383HappyCapybara콤보 (IOI18_combo)C++17
100 / 100
27 ms1932 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N){ string s; if (press("AB")){ if (press("A")) s = "A"; else s = "B"; } else { if (press("X")) s = "X"; else s = "Y"; } if (N == 1) return s; vector<string> v; for (string x : {"A", "B", "X", "Y"}) if (s != x) v.push_back(x); while (s.size() < N-1){ string p; p += s; p += v[0]; for (int i=0; i<3; i++){ p += s; p += v[1]; p += v[i]; } int res = press(p); if (res == s.size()+1) s += v[0]; else if (res == s.size()+2) s += v[1]; else s += v[2]; } if (press(s+v[0]) == N) return s+v[0]; if (press(s+v[1]) == N) return s+v[1]; return s+v[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (s.size() < N-1){
      |            ~~~~~~~~~^~~~~
combo.cpp:28:17: 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 (res == s.size()+1) s += v[0];
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:29:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         else if (res == s.size()+2) s += v[1];
      |                  ~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...