제출 #706499

#제출 시각아이디문제언어결과실행 시간메모리
706499Urvuk3콤보 (IOI18_combo)C++17
0 / 100
1 ms312 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define pb push_back
#define PRINTvec(niz) { cerr<<#niz<<"="; for(auto _i:niz) cerr<<_i<<" "; cerr<<endl; }

string guess_sequence(int N){
    if(N>1){
        int p=press("AB");
        string S="",T;
        if(p==2){
            S+="AB";
        }
        else if(p==1){
            p=press("AX");
            if(p==2) S+="AX";
            else if(p==1) S+="AY";
            else S+="BY";
        }
        else{
            p=press("X");
            if(p==1) S+="XY";
            else S+="YX";
        }
        T+=S[0];
        for(auto c:{'A','B','X','Y'}){
            if(c!=S[0]) T+=c;
        }
        while(sz(S)<N-1){
            p=press(S+T[1]+T[2]+S+T[1]+T[3]+S+T[2]);
            if(p==sz(S)+2) S.pb(T[1]);
            else if(p==sz(S)+1) S.pb(T[2]);
            else S.pb(T[3]);
        }
        if(N!=2){
            p=press(S+T[1]);
            if(p==N) return S+T[1];
            p=press(S+T[2]);
            if(p==N) return S+T[2];
            return S+T[3];
        }
    }
    else{
        int p=press("A");
        if(p) return "A";
        p=press("B");
        if(p) return "B";
        p=press("X");
        if(p) return "X";
        return "Y";
    }
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:65:1: warning: control reaches end of non-void function [-Wreturn-type]
   65 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...