제출 #516934

#제출 시각아이디문제언어결과실행 시간메모리
516934AngusWong콤보 (IOI18_combo)C++17
5 / 100
1 ms280 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string s="ABXY", ans=""; for (int i=0; i<=2; i++){ if (press(s.substr(i, 1))){ ans=s.substr(i, 1); s.erase(s.begin()+i); break; } } if (ans==""){ ans="Y"; s.erase(s.begin()+3); } for (int i=2; i<n; i++){ int t=press(ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]); if (t==i+1) ans+=s[0]; else if (t==i) ans+=s[1]; else ans+=s[2]; } for (int i=0; i<=1; i++){ if (press(ans+s[i])==n){ ans+=s[i]; break; } } if (ans.length()!=n) ans+=s[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     if (ans.length()!=n) ans+=s[2];
      |         ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...