Submission #1297417

#TimeUsernameProblemLanguageResultExecution timeMemory
1297417alexiahCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { string ans, opc; opc.push_back('A'); opc.push_back('B'); opc.push_back('X'); opc.push_back('Y'); int f1 , f2; f1 = press("AB"); f2 = press("AX"); if(f1 >= 1 && f2 >= 1){ ans.push_back('A'); swap(opc[0] , opc[3]); opc.pop_back(); swap(opc[0] , opc[1]); swap(opc[1] , opc[2]); } else if(f1 == 1 && f2 == 0){ ans.push_back('B'); swap(opc[1] , opc[3]); opc.pop_back(); swap(opc[1] , opc[2]); } else if(f1 == 0 && f2 == 1){ ans.push_back('X'); swap(opc[2] , opc[3]); opc.pop_back(); } else{ ans.push_back('Y'); opc.pop_back(); } for(int i = 1; i < n; i++){ string aux; aux += (ans + opc[0] + opc[0]); aux += (ans + opc[0] + opc[1]); aux += (ans + opc[0] + opc[2]); aux += (ans + opc[1]); int act = press(aux); if(act == i + 2) ans += opc[0]; else if(act == i + 1) ans += opc[1]; else ans += opc[2]; } int l1 , l2; l1 = press(opc[0] + opc[1]) , l2 = press(opc[0] + opc[2]); if(l1 >= 1 && l2 >= 1) ans += opc[0]; else if(l1 >= 1 && l2 == 0) ans += opc[1]; else ans += opc[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:21: error: could not convert '(((int)opc.std::__cxx11::basic_string<char>::operator[](0)) + ((int)opc.std::__cxx11::basic_string<char>::operator[](1)))' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   38 |   l1 = press(opc[0] + opc[1]) , l2 = press(opc[0] + opc[2]);
combo.cpp:38:51: error: could not convert '(((int)opc.std::__cxx11::basic_string<char>::operator[](0)) + ((int)opc.std::__cxx11::basic_string<char>::operator[](2)))' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   38 |   l1 = press(opc[0] + opc[1]) , l2 = press(opc[0] + opc[2]);