Submission #415190

#TimeUsernameProblemLanguageResultExecution timeMemory
415190aris12345678콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; const int mxN = 2005; string guess_sequence(int n) { string p = "", comb; if(press("A") == 1) p = "A", comb = "BXY"; else if(press("B") == 1) p = "B", comb = "AXY"; else if(press("X") == 1) p = "X", comb = "ABY"; else p = "Y", comb = "ABX"; while((int) p.length() < n-1) { int match = press(p+comb[0]+p+comb[1]+comb[0]+p+comb[1]+comb[1]+p+comb[1][2]); if(match == (int) p.length()) p += comb[2]; else if(match == (int) p.length()+1) p += comb[0]; else p += comb[1]; } if(press(p+comb[0]) == n) p += comb[0]; else if(press(p+comb[1]) == n) p += comb[1]; else p += comb[2]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:82: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
   18 |         int match = press(p+comb[0]+p+comb[1]+comb[0]+p+comb[1]+comb[1]+p+comb[1][2]);
      |                                                                                  ^