제출 #101899

#제출 시각아이디문제언어결과실행 시간메모리
101899joylintp콤보 (IOI18_combo)C++17
5 / 100
2 ms296 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans; char c[3]; int tmp = press("AB"); if (tmp == 2) ans += "AB", c[0] = 'B', c[1] = 'X', c[2] = 'Y'; else if (tmp == 1) if (press("A")) ans += "A", c[0] = 'B', c[1] = 'X', c[2] = 'Y'; else ans += "B", c[0] = 'A', c[1] = 'X', c[2] = 'Y'; else if (press("X")) ans += "X", c[0] = 'A', c[1] = 'B', c[2] = 'Y'; else ans += "Y", c[0] = 'A', c[1] = 'B', c[2] = 'X'; while (ans.size() <= n - 2) { int tmp = press(ans + c[0] + c[1] + ans + c[0] + c[2] + ans + c[0] + c[0] + ans + c[1]); if (tmp == ans.size() + 2) ans += c[0]; else if (tmp == ans.size() + 1) ans += c[1]; else ans += c[2]; } if (press(ans + c[0]) == n) return ans + c[0]; else if (press(ans + c[1]) == n) return ans + c[1]; else return ans + c[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     while  (ans.size() <= n - 2)
      |             ~~~~~~~~~~~^~~~~~~~
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 (tmp == ans.size() + 2)
      |             ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         else if (tmp == ans.size() + 1)
      |                  ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...