제출 #965020

#제출 시각아이디문제언어결과실행 시간메모리
965020ReLiceCombo (IOI18_combo)C++17
100 / 100
19 ms2024 KiB
#include "combo.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll int
#define str string
#define pb push_back
#define pob pop_back()
#define sz size()
#define bc back()
using namespace std;

str guess_sequence(ll n) {
    ll i,j;
    str s;
    vector<char> v={'A','B','X','Y'};
    ll x=press("AB");
    if(x){
        x=press("A");
        if(x)s="A";
        else s="B";
    }else{
        x=press("X");
        if(x)s="X";
        else s="Y";
    }
    if(n==1)return s;
    for(i=0;i<4;i++){
        if(v[i]==s[0]){
            swap(v[i],v.bc);
            v.pob;
            break;
        }
    }
    for(i=2;i<n;i++){
        x=press(s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
        if(x==s.sz+1)s+=v[0];
        else if(x>s.sz+1)s+=v[1];
        else s+=v[2];
    }
    x=press(s+v[0]+s+v[1]);
    if(x==n){
        x=press(s+v[0]);
        if(x==n)s+=v[0];
        else s+=v[1];
    }else s+=v[2];
    return s;
}








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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if(x==s.sz+1)s+=v[0];
      |            ~^~~~~~~~
combo.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         else if(x>s.sz+1)s+=v[1];
      |                 ~^~~~~~~
combo.cpp:13:10: warning: unused variable 'j' [-Wunused-variable]
   13 |     ll i,j;
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...