Submission #1206948

#TimeUsernameProblemLanguageResultExecution timeMemory
1206948a1m4nCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#ifdef AIMAN #define _GLIBCXX_DEBUG #endif #include "combo.h" #include <bits/stdc++.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 optimize("O2") #pragma GCC target("avx,avx2,fma") using ll = long long; const ll INF = 1e9; using namespace std; int press(string s) { cout << s << "\n" << flush; int res; if (!(cin >> res)) exit(0); return res; } string guess_sequence(int n) { string ans; int matched = 0; int x = press("AB"); if (x == 0) { x = press("X"); ans += (x == 1 ? 'X' : 'Y'); } else { x = press("A"); ans += (x == 1 ? 'A' : 'B'); } matched = 1; while (matched + 2 <= n) { char start = ans[0]; if (start == 'A') { x = press(ans + "BB" + ans + "BX" + ans + "BY" + ans + "X"); if (x == matched) ans += 'Y'; else if (x == matched + 1) ans += 'X'; else ans += 'B'; } else if (start == 'B') { x = press(ans + "AA" + ans + "AX" + ans + "AY" + ans + "X"); if (x == matched) ans += 'Y'; else if (x == matched + 1) ans += 'X'; else ans += 'A'; } else if (start == 'X') { x = press(ans + "AA" + ans + "AB" + ans + "AY" + ans + "B"); if (x == matched) ans += 'Y'; else if (x == matched + 1) ans += 'B'; else ans += 'A'; } else { x = press(ans + "BB" + ans + "BX" + ans + "BA" + ans + "X"); if (x == matched) ans += 'A'; else if (x == matched + 1) ans += 'X'; else ans += 'B'; } matched++; } if (matched == n - 1) { char start = ans[0]; if (start == 'A') { x = press(ans + "B"); if (x == n) ans += 'B'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'Y'); } } else if (start == 'B') { x = press(ans + "A"); if (x == n) ans += 'A'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'Y'); } } else if (start == 'X') { x = press(ans + "A"); if (x == n) ans += 'A'; else { x = press(ans + "B"); ans += (x == n ? 'B' : 'Y'); } } else { x = press(ans + "B"); if (x == n) ans += 'B'; else { x = press(ans + "X"); ans += (x == n ? 'X' : 'A'); } } } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccwXegOa.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc17SV5K.o:combo.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status