제출 #417848

#제출 시각아이디문제언어결과실행 시간메모리
417848rumen_m콤보 (IOI18_combo)C++17
100 / 100
50 ms644 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string s=""; string guess_sequence(int N) { string p; char A,B,C; p = "XY"; if(press(p)>0) { p = "X"; if(press(p)==1) { A = 'A'; B = 'B'; C = 'Y'; s = "X"; } else { A = 'A'; B = 'B'; C = 'X'; s = "Y"; } } else { p = "A"; if(press(p)==1) { A = 'X'; B = 'B'; C = 'Y'; s = "A"; } else { A = 'A'; B = 'Y'; C = 'X'; s = "B"; } } for(int i=2; i<N; i++) { p = s+A+s+B+A+s+B+B+s+B+C; int k = press(p); if(k==s.size())s+=C; if(k==s.size()+1)s+=A; if(k==s.size()+2)s+=B; } if(s.size()!=N) { p = s+A; if(press(p)==N) { s+=A; return s; } p = s+B; if(press(p)==N) { s+=B; return s; } s = s+C; return s; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:54:13: 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(k==s.size())s+=C;
      |            ~^~~~~~~~~~
combo.cpp:55:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         if(k==s.size()+1)s+=A;
      |            ~^~~~~~~~~~~~
combo.cpp:56:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         if(k==s.size()+2)s+=B;
      |            ~^~~~~~~~~~~~
combo.cpp:58:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |     if(s.size()!=N)
      |        ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...