Submission #1317892

#TimeUsernameProblemLanguageResultExecution timeMemory
1317892jokukCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include"combo.h" #include<bits/stdc++.h> using namespace std; vector<string> choices = {"A","B","X","Y"}; string guess_sequence(int n){ cin.tie(nullptr)->sync_with_stdio(false); string p=""; if(press("AB")) { if(press("A")) { p+="A"; } else { p+="B"; } } else { if(press=="X") { p+="X"; } else { p+="Y"; } } int cur = 1; for(int i = 0; i < 4; i++) { if(p[0] == choices[i][0]) { choices.erase(choices.begin()+i); } } for(int i=2;i<n;i++) { string temp = p+choices[0]; temp += p+choices[1]+choices[0]; temp += p+choices[1]+choices[1]; temp += p+choices[1]+choices[2]; int res = press(temp); if(res == cur) { p+=choices[2]; } else if(res == cur+1) { p+=choices[0]; } else if(res == cur+2) { p+=choices[1]; } cur++; } if(p.length()==n) return p; if(press(p+choices[0])==n) p+=choices[0]; else if(press(p+choices[1])==n) p+= choices[1]; else p+= choices[2]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:25: error: comparison between distinct pointer types 'int (*)(std::string)' {aka 'int (*)(std::__cxx11::basic_string<char>)'} and 'const char*' lacks a cast [-fpermissive]
   21 |                 if(press=="X")
      |                    ~~~~~^~~~~