제출 #314574

#제출 시각아이디문제언어결과실행 시간메모리
314574Jarif_Rahman콤보 (IOI18_combo)C++17
100 / 100
45 ms516 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; str guess_sequence(int n){ str s = ""; int r = 0; if(press("AB") > r){ if(press("A") > r) s+="A"; else s+="B"; } else{ if(press("X") > r) s+="X"; else s+="Y"; } r++; if(n == 1) return s; vector<str> ss; for(char c: "ABXY") if(c != s[0]) ss.pb(str(1, c)); while(s.size() < n - 1){ int x = press(s+ss[0] + s+ss[1]+ss[0] + s+ss[1]+ss[1] + s+ss[1]+ss[2]); x-=s.size(); if(x == 0) s+=ss[2]; else if(x == 1) s+=ss[0]; else s+=ss[1]; r++; } if(press(s+ss[0]+s+ss[1]) > r){ if(press(s+ss[0]) > r) s+=ss[0]; else s+=ss[1]; } else s+=ss[2]; r++; return s; }

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

combo.cpp: In function 'str guess_sequence(int)':
combo.cpp:23:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     while(s.size() < n - 1){
      |           ~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...