제출 #925766

#제출 시각아이디문제언어결과실행 시간메모리
925766Art_ogo콤보 (IOI18_combo)C++17
100 / 100
16 ms1640 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p; if(press("AB")){ if(press("A")) p = "A"; else p = "B"; } else{ if(press("X")) p = "X"; else p = "Y"; } string S = "ABXY"; S.erase(S.find(p), 1); char a = S[0], b = S[1], c = S[2]; while(p.size() < N - 1){ int ans = press(p + a + a + p + a + b + p + b + a); if(ans == p.size()) p += c; else if(ans == p.size() + 1){ ans = press(p + b + b); if(ans == p.size()) p = p + a + c; else if(ans == p.size() + 1) p = p + b + c; else p = p + b + b; } else{ ans = press(p + a + a); if(ans == p.size()) p = p + b + a; else if(ans == p.size() + 1) p = p + a + b; else p = p + a + a; } } if(p.size() != N){ if(press(p + "A" + p + "B") == N){ if(press(p + "A") == N) p = p + "A"; else p = p + "B"; } else{ if(press(p + "X") == N) p = p + "X"; else p = p + "Y"; } } //cout << p << endl; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     while(p.size() < N - 1){
      |           ~~~~~~~~~^~~~~~~
combo.cpp:23:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if(ans == p.size())
      |            ~~~~^~~~~~~~~~~
combo.cpp:25:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         else if(ans == p.size() + 1){
      |                 ~~~~^~~~~~~~~~~~~~~
combo.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             if(ans == p.size())
      |                ~~~~^~~~~~~~~~~
combo.cpp:29:25: 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(ans == p.size() + 1)
      |                     ~~~~^~~~~~~~~~~~~~~
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(ans == p.size())
      |                ~~~~^~~~~~~~~~~
combo.cpp:37:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             else if(ans == p.size() + 1)
      |                     ~~~~^~~~~~~~~~~~~~~
combo.cpp:42:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |     if(p.size() != N){
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...