Submission #675755

#TimeUsernameProblemLanguageResultExecution timeMemory
675755GGOSHABCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include "combo.h" #define PI 3.14159265359 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> bigInt; const ull INF = -1; int press(const string &s); string guess_sequence(int n) { string ans; ans.reserve(n); if (press("AB")) { if (press("A")) ans.push_back('A'); else ans.push_back('B'); } else { if (press("X")) ans.push_back('X'); else ans.push_back('Y'); } char ex = ans[0]; string t, letters = "ABXY", tl; for (char c : letters) if (c != ex) tl.push_back(c); t.reserve(4 * n); for (int i = 2; i <= n; ++i) { for (int i = 0; i < 3; ++i) { t += ans; t.push_back(tl[i]); } int size = t.length() / 3; if (press(t.substr(0, size << 1))) { if (press(t.substr(0, size))) ans.push_back(tl[0]); else ans.push_back(tl[1]); } else { ans.push_back(tl[2]); } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:19: error: call of overloaded 'press(const char [3])' is ambiguous
   21 |     if (press("AB")) {
      |                   ^
In file included from combo.cpp:3:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:16:5: note: candidate: 'int press(const string&)'
   16 | int press(const string &s);
      |     ^~~~~
combo.cpp:22:22: error: call of overloaded 'press(const char [2])' is ambiguous
   22 |         if (press("A"))
      |                      ^
In file included from combo.cpp:3:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:16:5: note: candidate: 'int press(const string&)'
   16 | int press(const string &s);
      |     ^~~~~
combo.cpp:28:22: error: call of overloaded 'press(const char [2])' is ambiguous
   28 |         if (press("X"))
      |                      ^
In file included from combo.cpp:3:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:16:5: note: candidate: 'int press(const string&)'
   16 | int press(const string &s);
      |     ^~~~~
combo.cpp:49:41: error: call of overloaded 'press(std::__cxx11::basic_string<char>)' is ambiguous
   49 |         if (press(t.substr(0, size << 1))) {
      |                                         ^
In file included from combo.cpp:3:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:16:5: note: candidate: 'int press(const string&)'
   16 | int press(const string &s);
      |     ^~~~~
combo.cpp:50:40: error: call of overloaded 'press(std::__cxx11::basic_string<char>)' is ambiguous
   50 |             if (press(t.substr(0, size)))
      |                                        ^
In file included from combo.cpp:3:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:16:5: note: candidate: 'int press(const string&)'
   16 | int press(const string &s);
      |     ^~~~~