pb_jiang

CF ROUND 1036 F WA

Aug 28th, 2025
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. // Problem: F1. From the Unknown (Easy Version)
  2. // Contest: Codeforces - Codeforces Round 1046 (Div. 2)
  3. // URL: https://codeforces.com/contest/2136/problem/F1
  4. // Memory Limit: 512 MB
  5. // Time Limit: 3000 ms
  6. //
  7. // Powered by CP Editor (https://cpeditor.org)
  8.  
  9. #include <assert.h>
  10. #include <bits/stdc++.h>
  11. using namespace std;
  12. #ifndef __DEBUG__
  13. #define dbg(...) 42
  14. #endif
  15. template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
  16.  
  17. namespace rngs = std::ranges;
  18. using ll = long long;
  19. using a2l = array<ll, 2>;
  20. using vl = vector<ll>;
  21.  
  22. ll ask(const vl &a)
  23. {
  24.     cout << "? " << a.size();
  25.     for (auto x : a)
  26.         cout << ' ' << x;
  27.     cout << '\n';
  28.     cout.flush();
  29.     ll line;
  30.     cin >> line;
  31.     return line;
  32. }
  33.  
  34. void answer(ll w)
  35. {
  36.     cout << "! " << w << '\n';
  37.     cout.flush();
  38. }
  39.  
  40. void solve()
  41. {
  42.     constexpr ll maxn = 1e5;
  43.     vl a(maxn, 1);
  44.     ll line = ask(a);
  45.     // maxn / line <= w <= (maxn - 1) / line + 1
  46.     vl b;
  47.     ll lb = maxn / line, ub = (maxn - 1) / line + 1;
  48.     dbg(line, lb, ub);
  49.     if (lb == ub) {
  50.         answer(lb);
  51.         return;
  52.     }
  53.     ll d = ub - lb;
  54.     for (ll i = 0; i < d; ++i)
  55.         b.push_back(lb), b.push_back(i + 1);
  56.  
  57.     ll res = ask(b);
  58.     answer(2 * d - res + lb);
  59. }
  60.  
  61. int main(int argc, char **argv)
  62. {
  63.     std::ios::sync_with_stdio(false);
  64.     std::cin.tie(nullptr);
  65.  
  66.     ll t = 1;
  67.     cin >> t;
  68.     while (t--)
  69.         solve();
  70.  
  71.     return 0;
  72. };
  73.  
Advertisement
Add Comment
Please, Sign In to add comment