Submission #897895

#TimeUsernameProblemLanguageResultExecution timeMemory
897895Rainmaker2627Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { vector<string> a; string s; if (press("AB")) { if (press("A")) { s="A"; a={"B", "X", "Y"}; } else { s="B"; a={"A", "X", "Y"}; } } else { if (press("X")) { s="X"; a={"A", "B", "Y"}; } else { s="Y"; a={"A", "B", "X"}; } } for (int i = 1; i < N-1; ++i) { string p = (s+a[0]+a[0])+(s+a[0]+a[1])+(s+a[0]+a[2])+(s+a[1]); int q = press(p); if (q==i) s+=a[2]; else if (q==i+1) s+=a[1]; else a+=a[0]; } if (N>1) { if (press(s+a[0])) s+=a[0]; else if (press(s+a[1])) s+=a[1]; else s+=a[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:9: error: no match for 'operator+=' (operand types are 'std::vector<std::__cxx11::basic_string<char> >' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   28 |   else a+=a[0];