제출 #1161941

#제출 시각아이디문제언어결과실행 시간메모리
1161941tsengang콤보 (IOI18_combo)C++20
5 / 100
0 ms412 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
const int mod = 998244353;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
string guess_sequence(int n){
    string s = "";
    vector<char> chr = {'A', 'B', 'X', 'Y'};
    if(press("AB") > 0){
        if(press("A") > 0){
            s += 'A';
            chr.erase(find(all(chr), 'A'));
        }
        else{
            s += 'B';
            chr.erase(find(all(chr), 'B'));
        }
    }
    else{
        if(press("X") > 0){
            s += 'X';
            chr.erase(find(all(chr), 'X'));
        }
        else{
            s += 'Y';
            chr.erase(find(all(chr), 'Y'));
        }
    }
    for(int i = 1;i < n-1; i++){
        string t= s + chr[0] + chr[0] + s + chr[0] + chr[1] + s + chr[0] + chr[2] + s + chr[1];
        int x=press(t);
        if(x==i+2){
            s+=chr[0];
        }
        else if(x==i+1){
            s+=chr[1];
        }
        else{
            s+=chr[2];
        }
    }
    if(press(s + chr[0]) == n){
        s += chr[0];
    }
    else if(press(s + chr[1]) == n){
        s += chr[1];
    }
    else{
        s += chr[2];
    }
    ertunt s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...