Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Problem: F1. From the Unknown (Easy Version)
- // Contest: Codeforces - Codeforces Round 1046 (Div. 2)
- // URL: https://codeforces.com/contest/2136/problem/F1
- // Memory Limit: 512 MB
- // Time Limit: 3000 ms
- //
- // Powered by CP Editor (https://cpeditor.org)
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- #ifndef __DEBUG__
- #define dbg(...) 42
- #endif
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- namespace rngs = std::ranges;
- using ll = long long;
- using a2l = array<ll, 2>;
- using vl = vector<ll>;
- ll ask(const vl &a)
- {
- cout << "? " << a.size();
- for (auto x : a)
- cout << ' ' << x;
- cout << '\n';
- cout.flush();
- ll line;
- cin >> line;
- return line;
- }
- void answer(ll w)
- {
- cout << "! " << w << '\n';
- cout.flush();
- }
- void solve()
- {
- constexpr ll maxn = 1e5;
- vl a(maxn, 1);
- ll line = ask(a);
- // maxn / line <= w <= (maxn - 1) / line + 1
- vl b;
- ll lb = maxn / line, ub = (maxn - 1) / line + 1;
- dbg(line, lb, ub);
- if (lb == ub) {
- answer(lb);
- return;
- }
- ll d = ub - lb;
- for (ll i = 0; i < d; ++i)
- b.push_back(lb), b.push_back(i + 1);
- ll res = ask(b);
- answer(2 * d - res + lb);
- }
- int main(int argc, char **argv)
- {
- std::ios::sync_with_stdio(false);
- std::cin.tie(nullptr);
- ll t = 1;
- cin >> t;
- while (t--)
- solve();
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment