Submission #550424

#TimeUsernameProblemLanguageResultExecution timeMemory
550424don2001Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define fast ios::sync_with_stdio(false); cin.tie(NULL); using namespace std; #include "combo.h" string guess_sequence(int n) { string ans; vector<char>v; int a=press("AB"); int b=press("XY"); if(a>0){ int c=press("A"); if(c>0){ ans.push_back('A'); v.push_back('B');v.push_back('X');v.push_back('Y'); } else{ ans.push_back('B'); v.push_back('A');v.push_back('X');v.push_back('Y'); } } else{ int c=press("X"); if(c>0){ ans.push_back('X'); } else{ ans.push_back('Y'); } } for(int i=1;i<n-1;i++){ string ask; ask+=ans; ask+=v[0]; ask+=ans; ask+=v[1];ask+=v[0]; ask+=ans; ask+=v[1];ask+=v[1]; ask+=ans; ask+=v[1];ask+=v[2]; if(press(ask)==i+2){ ans.push_back(v[1]); } else if(press(ask)==i+1){ ans.push_back(v[0]); } else{ ans.push_back(v[2]); } } for(int i=0;i<=1;i++){ string s=ans+v[i]; if(press(s)==n){ f=0; ans=s; } } if(f){ ans=ans+v[2]; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:53:4: error: 'f' was not declared in this scope
   53 |    f=0;
      |    ^
combo.cpp:57:5: error: 'f' was not declared in this scope
   57 |  if(f){
      |     ^
combo.cpp:9:6: warning: unused variable 'b' [-Wunused-variable]
    9 |  int b=press("XY");
      |      ^