제출 #425857

#제출 시각아이디문제언어결과실행 시간메모리
425857TryMax콤보 (IOI18_combo)C++17
100 / 100
86 ms632 KiB
#include "combo.h" #include <bits/stdc++.h> #ifdef LOCAL #include "grader.cpp" #endif // LOCAL #define pb push_back using namespace std; char c1[4]; string guess_sequence(int n) { string res; c1[0] = 'A'; c1[1] = 'B'; c1[2] = 'X'; c1[3] = 'Y'; if(n == 1){ for(int i = 0; i <= 2; ++i){ string q; q += c1[i]; if(press(q)) return q; } if(res.empty()) res += c1[3]; return res; } int st; if(press("AB")){ if(press("A")) st = 0; else st = 1; }else{ if(press("X")) st = 2; else st = 3; } vector<char> c; for(int i = 0; i <= 3; ++i) if(i != st) c.pb(c1[i]); res += c1[st]; // cout << res << endl; for(int i = 1; i < n - 1; ++i){ string q; q += res + c[0]; for(int i = 0; i < 3; ++i) q += res + c[1] + c[i]; int sz = press(q); if(sz == res.size()) res += c[2]; else if(sz == res.size() + 1) res += c[0]; else res += c[1]; // cout << q << endl; // cout << res << endl; } if(press(res + c[0] + res + c[1]) > res.size()){ if(press(res + c[0]) > res.size()) res += c[0]; else res += c[1]; }else res += c[2]; return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:54:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         if(sz == res.size())
      |            ~~~^~~~~~~~~~~~~
combo.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         else if(sz == res.size() + 1)
      |                 ~~~^~~~~~~~~~~~~~~~~
combo.cpp:63:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |     if(press(res + c[0] + res + c[1]) > res.size()){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:64:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         if(press(res + c[0]) > res.size())
      |            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...