Submission #1317013

#TimeUsernameProblemLanguageResultExecution timeMemory
1317013marzuq01Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string ans; //std::string s; std::string alp = "ABXY"; int coin; coin = press("AB"); if(coin) { coin = press("A"); if (coin) ans = "A"; else ans = "B"; } else { coin = press("X"); if (coin) ans = "X"; else ans = "Y"; } std::string temp; for (auto i: alp) if (i != ans[0]) temp += i; //int tindex = 0; //012 while(ans.size() < N) { int now = ans.size(); string s = ans + temp[0] + temp[1] + ans+ temp[0] + temp[2] + ans + temp[0] + temp[0] + ans + temp[1]; coin = press(s); if (coin == now) ans += temp[2]; else if (coin == now + 1) ans += temp[1]; else ans += temp[0]; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:9: error: 'string' was not declared in this scope
   23 |         string s = ans + temp[0] + temp[1] + ans+ temp[0] + temp[2] + ans + temp[0] + temp[0] + ans + temp[1];
      |         ^~~~~~
combo.cpp:23:9: note: suggested alternatives:
In file included from /usr/include/c++/13/string:41,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
combo.cpp:24:22: error: 's' was not declared in this scope
   24 |         coin = press(s);
      |                      ^