Submission #550433

#TimeUsernameProblemLanguageResultExecution timeMemory
550433don2001Combo (IOI18_combo)C++17
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'); 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'); v.push_back('A');v.push_back('B');v.push_back('Y'); } else{ ans.push_back('Y'); v.push_back('A');v.push_back('B');v.push_back('X'); } } 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]; int val=press(ask); if(val==i+2){ ans.push_back(v[1]); } else if(val==i+1){ ans.push_back(v[0]); } else{ ans.push_back(v[2]); } } bool f=1; 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:7:14: warning: multi-character character constant [-Wmultichar]
    7 |  int a=press('AB');
      |              ^~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:14: error: could not convert '16706' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}