Submission #132471

#TimeUsernameProblemLanguageResultExecution timeMemory
132471nxteruCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string ans; char c[3],d[4]={'A','B','X','Y'}; bool u[4]; string q; string guess_sequence(int n){ q+=d[0]; q+=d[1]; if(press(q)==1){ q.pop_back(); if(press(q)==1)u[0]=true; else u[1]=true; }else{ q.clear(); q.push_back(d[2]); if(press(q)==1)u[2]=true; else u[3]=true; } int k=0; for(int i=0;i<4;i++){ if(!u[i])c[k++]=d[i]; else ans.push_back(d[i]); } for(int i=2;i+1<=n;i++){ q.clear(); q+=ans; q.push_back(c[0]); for(int j=0;j<3;j++){ q+=ans; q.push_back(c[1]); q.push_back(c[j]); } int s=press(q); if(s==n-1)ans.push_back(c[2]); else if(s==n)ans.push_back(c[0]); else ans.push_back(c[1]); } if(ans.size()==n)return ans; q.clear(); q+=ans; q.push_back(c[0]); q+=ans; q.push_back(c[1]); if(press(q)==n){ q.clear(); q+=ans; q.push_back(c[0]); if(press(q)==n)ans.push_back(c[0]); else ans.push_back(c[1]); }else{ q.clear(); q+=ans; q.push_back(c[2]); if(press(q)==n)ans.push_back(c[2]); else ans.push_back(c[3]); } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:6: error: 'press' was not declared in this scope
   10 |   if(press(q)==1){
      |      ^~~~~
combo.cpp:34:11: error: 'press' was not declared in this scope
   34 |     int s=press(q);
      |           ^~~~~
combo.cpp:39:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |   if(ans.size()==n)return ans;
      |      ~~~~~~~~~~^~~
combo.cpp:45:6: error: 'press' was not declared in this scope
   45 |   if(press(q)==n){
      |      ^~~~~