제출 #534562

#제출 시각아이디문제언어결과실행 시간메모리
534562Abdulmohsen1284콤보 (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h"
#include"bits/stdc++.h"
using namespace std;
std::string guess_sequence(int N) {
    string g,s;
    g="AB";
    long long ans=press(g);
    if(ans==1)
    {
        g="A";
        ans=press(g);
        if(ans==1)
            s="A";
        else
            s="B";
    }
    else
    {
        g="X";
        ans=press(g);
        if(ans==1)
            s="X";
        else
            s="Y";
    }
    string a;
    long long cur=0;
    string chek="ABXY";
    for(int i=0;i<(int)chek.size();i++)
    {
        if(s[0]!=chek[i])
        {
            a+=chek[i];
        }
    }
    chek=a;
    for(int i=1;i<N-1;i++)
    {
        string rn;
        rn=s+chek[0];
        for(int j=0;j<3;j++)
            rn+=s+chek[1]+chek[j];
        ans=press(rn);
        if(ans==(long long)s.size())
        {
            s+=chek[2];
        }
        if(ans==(long long)s.size()+1)
        {
            s+=chek[0];
        }
        if(ans==(long long)s.size()+2)
        {
            s+=chek[1];
        }
    }
    if(N!=1)
    {
        string rn=s+chek[0]+s+chek[2];
        ans=press(rn);
        if(ans==(long long)s.size()+1)
        {
            rn=s+chek[0];
            ans=press(rn);
            if(ans==(long long)s.size()+1)
                s+=chek[0];
            else
                s+=chek[1];
        }
        else
        {
                s+=chek[2];
        }
    }
    return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:15: warning: unused variable 'cur' [-Wunused-variable]
   27 |     long long cur=0;
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...