제출 #714272

#제출 시각아이디문제언어결과실행 시간메모리
714272Astrayt콤보 (IOI18_combo)C++17
5 / 100
1 ms304 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define pb push_back string guess_sequence(int N) { string S = ""; int tmp = press("AB"); if(tmp == 2) S += "AB"; else if(tmp == 1){ tmp = press("A"); if(tmp) S += "A"; else S += "B"; }else{ tmp = press("X"); if(tmp) S += "X"; else S += "Y"; } vector<string> C; for(auto c:{"A", "B", "X", "Y"}){ if(c[0] != S[0]) C.pb(c), cerr << c << '\n'; } cerr << S << '\n'; while(S.size() < N - 1){ string Q = ""; for(string s : C){ Q += S + C[0] + s; } Q += S + C[1]; cerr << Q << '\n'; tmp = press(Q); if(tmp == S.size() + 2) S += C[0]; else if(tmp == S.size() + 1) S += C[1]; else S += C[2]; } tmp = press(S + C[0]); cerr << S + C[0] << '\n'; if(tmp == N) S += C[0]; else { tmp = press(S + C[1]); if(tmp == N) S += C[1]; else S += C[2]; } cerr << S << '\n'; return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |  while(S.size() < N - 1){
      |        ~~~~~~~~~^~~~~~~
combo.cpp:32:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(tmp == S.size() + 2) S += C[0];
      |      ~~~~^~~~~~~~~~~~~~~
combo.cpp:33:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   else if(tmp == S.size() + 1) S += C[1];
      |           ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...