Submission #1129908

#TimeUsernameProblemLanguageResultExecution timeMemory
1129908pedreitorzeldaCombo (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 ans = ""; vector<char>possible = {'A','B','X','Y'}; vector<char>npossible = {'A','B','X','Y'}; for(int i=0;i<N;i++){ if(i==n-1){ string q = ""; q+=ans+npossible[0]; q+=ans+npossible[1]; int tmp = press(q); if(tmp==n){ q=ans+npossible[0]; tmp = press(q); if(tmp==n)ans+=npossible[0]; else ans+=npossible[1]; }else{ if(npossible.size()==3)ans+=npossible[2]; else{ q=ans+npossible[2]; tmp = press(q); if(tmp==n)ans+=npossible[2]; else ans+=npossible[3]; } } }else if(i==0){ string q = ""; q+=possible[0]+possible[1]; int tmp = press(q); if(tmp==1){ q = possible[0]; tmp = press(q); if(tmp==1)ans+=possible[0]; else ans+=possible[1]; }else{ q = possible[2]; tmp = press(q); if(tmp==1)ans+=possible[2]; else ans+=possible[3]; }npossible.clear(); for(int j=0;j<4;j++){ if(possible[j]!=ans[0])npossible.push_back(possible[j]); } }else{ string q = ""; q+=ans+npossible[0]; for(int j=0;j<3;j++){ q+=ans+npossible[1]+npossible[j]; }int tmp = press(q); if(tmp==1){ ans+=npossible[0]; }else if(tmp==2){ ans+=npossible[1]; }else{ ans+=npossible[2]; } } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:15: error: 'n' was not declared in this scope
    9 |         if(i==n-1){
      |               ^