Submission #534339

#TimeUsernameProblemLanguageResultExecution timeMemory
534339MrDebooCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
// #define int long long
using namespace std;
std::string guess_sequence(int n) {
    char f[]={"A","B","X","Y"};
    string s;
    for(auto &i:f){
        string g;
        g+=i;
        if(press(g)!=0){s+=i;break;}
    }
    vector<char>v;
    for(auto &i:f)if(i!=s[0])v.push_back(i);
    for(int i=1;i<n;i++){
        bool bl=0;
        for(int w=0;w<2;w++){
            if(press(s+v[w])==i+1){
                s+=v[w];
                bl=1;
                break;
            }
        }
        if(!bl)s+=v.back();
    }
    return s;
  // std::string p = "";
  // for (int i = 0; i < 4 * N; ++i) {
  //   p += 'A';
  // }
  // int coins = press(p);
  // std::string S = "";
  // for (int i = 0; i < N; ++i) {
  //   S += 'A';
  // }
  // return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:30: error: too many initializers for 'char []'
    6 |     char f[]={"A","B","X","Y"};
      |                              ^