제출 #576689

#제출 시각아이디문제언어결과실행 시간메모리
576689Halym2007콤보 (IOI18_combo)C++11
100 / 100
41 ms580 KiB
#include "combo.h" #include <bits/stdc++.h> #define ff first #define ss second #define cont continue; #define sz size() #define pb push_back using namespace std; typedef long long ll; // const int N = 100005; vector <char> v = {'X', 'Y', 'A', 'B'}; string s, hp, gp; vector <char> q; int jp; string guess_sequence(int N) { int a = press("AB"); if (a) { if (press("A")) { s += 'A'; } else s += 'B'; } else { if (press("X")) { s += 'X'; } else s += 'Y'; } for (int i = 0; i < 4; i++) { if (v[i] != s[0]) { q.pb (v[i]); } } while (s.sz < N-1) { hp += s + q[0]; hp += s + q[1] + q[1]; hp += s + q[1] + q[2]; hp += s + q[1] + q[0]; jp = press(hp); if (jp == s.sz) { s += q[2]; } else if (jp == s.sz + 1) { s += q[0]; } else s += q[1]; hp = ""; } if (N > 1){ if (press(s + q[0]) == s.sz + 1) s += q[0]; else if (press(s + q[1]) == s.sz + 1) s += q[1]; else s += q[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:14: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |  while (s.sz < N-1) {
      |         ~~~~~^~~~~
combo.cpp:42:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   if (jp == s.sz) {
      |          ^
combo.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   else if (jp == s.sz + 1) {
      |            ~~~^~~~~~~~~~~
combo.cpp:52:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   if (press(s + q[0]) == s.sz + 1) s += q[0];
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:53:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   else if (press(s + q[1]) == s.sz + 1) s += q[1];
      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...