Submission #1206941

#TimeUsernameProblemLanguageResultExecution timeMemory
1206941a1m4n콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#ifdef AIMAN #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #include "combo.h" #define rep(i, n) for (int i = 0; i < (n); ++i) #define pb push_back #define eb emplace_back #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("O2") using ll = long long; ll inf = 1e9; using namespace std; int press(const string &x){ cout << x << "\n" <<flush; int res; if(!cin >> res){ exit(0); } return res; } string guess_sequence(int N){ static const char c[4] = {'A' , 'B' , 'X' , 'Y'}; string p; for(int i = 0;i < 4; i++){ string q(1, c[i]); if(press(q) == 1){ p = q; break; } } for(int i = 1; i < N; i++){ for(int j = 0; j < 4; j++){ string q = p; q.pb(c[j]); if(press(q) == i + 1){ p.pb(c[j]); break; } } } return p; } void solve(){ } int main(){ ios::sync_with_stdio(false); cin.tie(0);solve(); return 0; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:17: error: call of overloaded 'press(std::string&)' is ambiguous
   29 |         if(press(q) == 1){
      |            ~~~~~^~~
In file included from combo.cpp:5:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:17:5: note: candidate: 'int press(const string&)'
   17 | int press(const string &x){
      |     ^~~~~
combo.cpp:38:25: error: call of overloaded 'press(std::string&)' is ambiguous
   38 |                 if(press(q) == i + 1){
      |                    ~~~~~^~~
In file included from combo.cpp:5:
combo.h:7:5: note: candidate: 'int press(std::string)'
    7 | int press(std::string p);
      |     ^~~~~
combo.cpp:17:5: note: candidate: 'int press(const string&)'
   17 | int press(const string &x){
      |     ^~~~~