Submission #1291604

#TimeUsernameProblemLanguageResultExecution timeMemory
1291604trandangquangCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define foru(i,a,b) for(int i=(a); i<=(b); ++i) #define ford(i,a,b) for(int i=(a); i>=(b); --i) #define rep(i,a) for(int i=0; i<(a); ++i) #define sz(a) (int)(a).size() #define all(a) (a).begin(),(a).end() #define bit(s,i) (((s)>>(i))&1) #define ii pair<int,int> #define fi first #define se second #define pb push_back #define eb emplace_back #define ll long long #define _ << " " << template <class X, class Y> bool maxi(X &x, Y y){return x<y?x=y,true:false;} template <class X, class Y> bool mini(X &x, Y y){return x>y?x=y,true:false;} string guess_sequence(int n){ string res; string t; if(press("AB"))t="AB"; else t="XY"; char c; if(press(t.substr(0,1))) c=t[0]; else c=t[1]; string h; for(char ch:"ABXY") if(ch!=c) h=h+c; res=res+c; foru(i,2,n-1){ int tmp=press(res+h[0]+h[0]+c+res+h[0]+h[1]+c+res+h[0]+h[2]+c+res+h[1]); if(tmp==i-1) res=res+h[2]; else if(tmp==i) res=res+h[1]; else if(tmp==i+1) res=res+h[0]; else assert(0); } c=h[0]; if(press(res+h[1])==n)c=h[1]; if(press(res+h[2])==n)c=h[2]; res=res+c; return res; } //int press(int p){ // //} //int32_t main(){ // #define task "test" // if(fopen(task".inp","r")){ // freopen(task".inp","r",stdin); // freopen(task".out","w",stdout); // } // cin.tie(0)->sync_with_stdio(0); // // int tc=1; //cin>>tc; // rep(i,tc){ // solve(); // } //}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:8: error: 'press' was not declared in this scope; did you mean 'res'?
   26 |     if(press("AB"))t="AB";
      |        ^~~~~
      |        res
combo.cpp:30:8: error: 'press' was not declared in this scope; did you mean 'res'?
   30 |     if(press(t.substr(0,1))) c=t[0];
      |        ^~~~~
      |        res
combo.cpp:38:17: error: 'press' was not declared in this scope; did you mean 'res'?
   38 |         int tmp=press(res+h[0]+h[0]+c+res+h[0]+h[1]+c+res+h[0]+h[2]+c+res+h[1]);
      |                 ^~~~~
      |                 res
combo.cpp:46:8: error: 'press' was not declared in this scope; did you mean 'res'?
   46 |     if(press(res+h[1])==n)c=h[1];
      |        ^~~~~
      |        res
combo.cpp:47:8: error: 'press' was not declared in this scope; did you mean 'res'?
   47 |     if(press(res+h[2])==n)c=h[2];
      |        ^~~~~
      |        res