제출 #215942

#제출 시각아이디문제언어결과실행 시간메모리
215942tushar_2658콤보 (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string ans; ans ="A"; int tot = press(ans); if(tot == 0){ ans = "B"; tot = press(ans); } else if(tot == 0){ ans = "X"; tot = press(ans); } else if(tot == 0){ ans = "Y"; } if(N == 1){ string ret; ret += ans[0]; return ret; } string ss = "ABXY"; char c; for(int j = 0; j < 3; j++){ if(ss[j] == ans[0]){ ss.erase(j, 1); } } c = ss.back(); ss.pop_back(); for(int i = 1; i < N; ){ string dummy; dummy += ss[0]; dummy += c; int x = press(ans + dummy); if(x == tot + 2){ ans += dummy; tot += 2; i += 2; continue; }else if(x == tot + 1){ ans += ss[0]; i++; tot++; continue; } dummy[0] = ss[1]; x = press(ans + dummy); if(x == tot + 2){ ans += dummy; tot += 2; i += 2; continue; }else if(x == tot + 1){ ans += ss[0]; i++; tot++; continue; } dummy = c; dummy += c; if(press(ans + dummy) == tot + 2){ ans += dummy; tot += 2; i += 2; }else { ans += c; tot++; i++; } } if(ans.size() != N){ if(press(ans + ss[0]) == tot + 1){ ans += ss[0]; }else { ans += ss[1]; } } return ans; }

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

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