제출 #103628

#제출 시각아이디문제언어결과실행 시간메모리
103628medkCombo (IOI18_combo)C++14
5 / 100
3 ms256 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
/*
int press(string x)
{
    cout<<x<<'\n';
    int ret; cin>>ret;
    return ret;
}
*/
string guess_sequence(int N)
{
    string ans="";
    char ci[4]={'A','B','X','Y'};
      vector<char> c;
    int found=1;
    if(press("AB"))
    {
        if(press("A")) ans="A";
        else ans="B";
    }
    else
    {
        if(press("X")) ans="X";
        else ans="Y";
    }
    int ind=0;
    for(int i=0;i<4;i++)
    {
        if(ci[i]!=ans[0]){
            c.push_back(ci[i]);
        }
    }
    for(int i=0;i<N-2;i++)
    {
        string pr=ans+c[0]+ans+c[1]+c[0]+ans+c[1]+c[1]+ans+c[1]+c[2];
        int get=press(pr);
        if(get==(int) ans.length()+2)
        {
            ans+=c[1];
        }
    else if(get==(int) ans.length()+1)
        {
            ans+=c[0];
        }
        else
        {
            ans+=c[2];
        }

    }
    if(press(ans+c[0])==N) ans+=c[0];
    else if(press(ans+c[1])==N) ans+=c[1];
    else ans+=c[2];
    return ans;
}

/*
int main()
{
    //string ans=guess_sequence(8);
    cout<<ans<<'\n';
    return 0;
}
*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:9: warning: unused variable 'found' [-Wunused-variable]
   20 |     int found=1;
      |         ^~~~~
combo.cpp:31:9: warning: unused variable 'ind' [-Wunused-variable]
   31 |     int ind=0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...