#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; } int main() { ios::sync_with_stdio(false); cin.tie(0); string player; cin >> player; int side = player == "Alice" ? 0 : 1; int q, n, m; cin >> q >> n >> m; vector

a(n), b(m); if (side == 0) { rep(i, n) cin >> a[i].first, a[i].second = i; } else { rep(i, m) cin >> b[i].first, b[i].second = i; } sort(all(a)); sort(all(b)); if (n < m) swap(a, b), swap(n, m), side ^= 1; int half = (n + m - 1) / 2 + 1; int l = half - m - 1, r = half + 1; int ans = 0; while (r - l > 1) { int c = (l + r) / 2; int d = half - c; int va = a[n-c].first, vb = d == 0 ? 1001001001 : b[m-d].first; if (side == 0) cout << "share " << a[n-c].second + 1 << endl; else cout << "share " << (d == 0 ? 0 : b[m-d].second) + 1 << endl; int res; cin >> res; if (d == 0) { if (side == 1) va = res; } else { (side == 0 ? vb : va) = res; } chmax(ans, min(va, vb)); (va >= vb ? l : r) = c; } cout << "answer " << ans << endl; }