Submission #1052187

#TimeUsernameProblemLanguageResultExecution timeMemory
1052187khanhtb콤보 (IOI18_combo)C++14
0 / 100
0 ms380 KiB
#include <bits/stdc++.h>
#include "combo.h"
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define vii vector<vi>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7; 
const ll inf = 2e18;
const ll B = 320;
const ll N = 1e5+8;
string ans = "";
vector<char> bt = {'A','B','X','Y'};
string guess_sequence(int N){
    int fid = 0;
    if(press("AB")){
        if(press("A")) fid = 0;
        else fid = 1;
    }
    else{
        if(press("X")) fid = 2;
        else fid = 3;
    }
    ans += bt[fid];
    while(ans.size() < N){
        int i1 = -1, i2 = -1, i3 = -1;
        for(int i = 0; i < 4; i++){
            if(i == fid) continue;
            if(i1 == -1) i1 = i;
            else if(i2 == -1) i2 = i;
            else i3 = i;
        }
        int rep = press(ans + bt[i1] + bt[i2] + bt[i3] + ans + bt[i2] + bt[i3] + ans + bt[i3]);
        if(rep == ans.size()+1) ans += bt[i3];
        else if(rep == ans.size()+2) ans += bt[i2], ans += bt[i3];
        else ans += bt[i1], ans += bt[i2], ans += bt[i3];
    }
    return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     while(ans.size() < N){
      |           ~~~~~~~~~~~^~~
combo.cpp:42:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         if(rep == ans.size()+1) ans += bt[i3];
      |            ~~~~^~~~~~~~~~~~~~~
combo.cpp:43:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         else if(rep == ans.size()+2) ans += bt[i2], ans += bt[i3];
      |                 ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...