Submission #1142667

#TimeUsernameProblemLanguageResultExecution timeMemory
1142667younesb2Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int n) {
    string a="";
    int b=0;
    vector <char> c={'A','B','X','Y'};
    for(int i=0;i<n;i++) {
        for(const auto& i : c) {
            a.push_back(i);
            int i=press(a);
            if(i-b==1) {
                b++;
                break;
            }
            a.pop_back();
        }
    }
    return a;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:17: error: redeclaration of 'int i'
   13 |             int i=press(a);
      |                 ^
combo.cpp:11:25: note: 'const char& i' previously declared here
   11 |         for(const auto& i : c) {
      |                         ^