Submission #191324

#TimeUsernameProblemLanguageResultExecution timeMemory
191324anubhavdharCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<n;i++) #define FORe(i,n) for(i=1;i<=n;i++) #define FORr(i,a,b) for(i=a;i<b;i++) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> using namespace std; /* const ll MAXN = 2e5+5; const ll MOD = 1e9+7; const ll ROOTN = 320; const ll LOGN = 17; const ll INF = 1e17 + 1101; inline int press(string S) { cout<<"pressing : "<<S<<endl; ll p; cin>>p; return p; }*/ char guess_first_char() { ll i = press("XY"); if (i) { if (press("X")) return 'X'; return 'Y'; } else { if (press("A")) return 'A'; return 'B'; } } string guess_sequence(int N) { char P[3],c = guess_first_char(); ll i = 0,sz; string S = ""; S += c; for(char dd : {'A','B','X','Y'}) if (dd != c) P[i++] = dd; FORe(i,N-2) { sz = press(S+P[0]+S+P[1]+P[0]+S+P[1]+P[1]+S+P[1]+P[2]); if (sz == S.size()) S += P[2]; else if(sz == S.size() + 1) S += P[0]; else if(sz == S.size() + 2) S += P[1]; else return "SHOULDNOTBEOUTPUT"; } if (N == press(S+P[0])) S+=P[0]; else if(N == press(S+P[1])) S+=P[1]; else S+=P[2]; return S; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll N; cin>>N; cout<<"output :"<<guess_sequence(N); return 0; }*/

Compilation message (stderr)

combo.cpp: In function 'char guess_first_char()':
combo.cpp:35:9: error: 'press' was not declared in this scope
   35 |  ll i = press("XY");
      |         ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:61:8: error: 'press' was not declared in this scope
   61 |   sz = press(S+P[0]+S+P[1]+P[0]+S+P[1]+P[1]+S+P[1]+P[2]);
      |        ^~~~~
combo.cpp:62:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   if (sz == S.size())
      |       ~~~^~~~~~~~~~~
combo.cpp:64:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |   else if(sz == S.size() + 1)
      |           ~~~^~~~~~~~~~~~~~~
combo.cpp:66:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |   else if(sz == S.size() + 2)
      |           ~~~^~~~~~~~~~~~~~~
combo.cpp:71:11: error: 'press' was not declared in this scope
   71 |  if (N == press(S+P[0]))
      |           ^~~~~