Submission #99895

#TimeUsernameProblemLanguageResultExecution timeMemory
998951KhanCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
// In the name of GOD #include "combo.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' string guess_sequence(int n){ string s; if(n == 1){ int p = press("A"); if(p){ s += 'A'; return s; } p = press("B"); if(p){ s += 'B'; return s; } p = press("X"); if(p){ s += 'x'; return s; } p = press("Y"); if(p){ s += 'y'; return s; } } if(n == 2){ string k[111]; k[1] = "AB"; k[2] = "AX"; k[3] = "AY"; k[4] = "BX"; k[5] = "BY"; k[6] = "BA"; k[7] = "XA"; k[8] = "XY"; k[9] = "XB"; k[10] = "YA"; k[11] = "YB"; k[12] = "YX"; } if(n == 3){ string k[] = { "ABX", "ABY", "ABB", "AXY", "AXB", "AXX", "AYX", "AYB", "AYY", "BAX", "BAY", "BAA", "BXA", "BXY", "BXX", "BYA", "BYX", "BYY", "XAB", "XAY", "XAA", "XBA", "XBY", "XBB", "XYA", "XYB", "XYY", "YAB", "YAX", "YAA", "YBA", "YBX", "YBB", "YXA", "YXB", "YXX", }; int w = 0; for(int i = 0; ; ++i){ if(s[i].size() == 0){ break; } int val = press(k[i]); w = max(w, val); if(w == val){ s = k[i]; } } return s; } else{ s += "ABXY"; return s; } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:89:24: error: request for member 'size' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   89 |                if(s[i].size() == 0){
      |                        ^~~~