제출 #661158

#제출 시각아이디문제언어결과실행 시간메모리
661158NekoRolly콤보 (IOI18_combo)C++17
100 / 100
30 ms560 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; vector<char> v; string S(char a,char b){ string s; s += v[a], s += v[b]; return s; } 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; for (char c : {'A', 'B', 'X', 'Y'}) if (c != s[0]) v.push_back(c); for (int i=1; i<n-1; i++){ string t = s; t += S(0, 0), t += s, t += S(0, 1), t += s; t += S(0, 2), t += s, t += v[1]; int x = press(t); if (x == 2+s.size()) s += v[0]; else if (x == 1+s.size()) s += v[1]; else s += v[2]; } if (press(s + v[0]) == n) s += v[0]; else if (press(s + v[1]) == n) s += v[1]; else s += v[2]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   if (x == 2+s.size()) s += v[0];
      |       ~~^~~~~~~~~~~~~
combo.cpp:32:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   else if (x == 1+s.size()) s += v[1];
      |            ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...