제출 #1305218

#제출 시각아이디문제언어결과실행 시간메모리
1305218iamsazidh콤보 (IOI18_combo)C++20
91 / 100
9 ms476 KiB
#include "combo.h"
//ᴇᴀᴄʜ ᴘᴇʀꜱᴏɴ ᴡɪʟʟ ᴏɴʟʏ ʜᴀᴠᴇ ᴡʜᴀᴛ ᴛʜᴇʏ ᴇɴᴅᴇᴀᴠᴏᴜʀᴇᴅ ᴛᴏᴡᴀʀᴅꜱ [53:39]
//Author: Sazid Hasan
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef double                 dl;
typedef vector<int>            vi;
typedef vector<vector<int>>    vii;
typedef vector<ll>             vl;
typedef vector<bool>           vb;
typedef pair<int,int>         pii;
typedef pair<ll, ll>          pll;

#define ff                first
#define ss                second
#define all(a)            a.begin(),a.end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          (a*(b/gcd(a,b)))
#define spc               " "

#ifdef ONLINE_JUDGE
    #define debarr(array)
    #define deb(x)
    #define del
#else
    #define debarr(array)  for(int w = 0; w < array.size(); w++) cerr << #array << "-" << w << " = " << array[w] << endl;
    #define deb(x)         cerr << #x << " = " << x << endl;
    #define del cerr << '\n';
#endif


const double PI =         acos(-1);
const int MOD =           1000000007;
const int inf =           (2147483647);


std::string guess_sequence(int N) {
    string s = "";
    vector<char> ch = {'A', 'B', 'X', 'Y'};
    int i;
    for(i = 0; i < 3; i++){
        int now = press(s+ch[i]);
        if(now==1) break;
    }
    s = ch[i];
    auto itr = find(all(ch), ch[i]);
    ch.erase(itr);

    for(i = 1; i < N-1; i++){
        int now = press(s+ch[0] + s+ch[1]+ch[0] + s+ch[1]+ch[1] + s+ch[1]+ch[2]);
        if(now==1+i) s.push_back(ch[0]);
        else if(now==2+i) s.push_back(ch[1]);
        else s.push_back(ch[2]);
    }
    for(auto x: ch){
        int now = press(s+x);
        if(now>(int)s.size()){
            s.push_back(x);
            break;
        }
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...