Advertisement
Guest User

Untitled

a guest
Dec 29th, 2019
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5. #include <queue>
  6. #include <algorithm>
  7. #include <string>
  8. #include <cmath>
  9. #include <cstdio>
  10. #include <iomanip>
  11. #include <fstream>
  12. #include <cassert>
  13. #include <cstring>
  14. #include <unordered_set>
  15. #include <unordered_map>
  16. #include <numeric>
  17. #include <ctime>
  18. #include <bitset>
  19. #include <complex>
  20. #include <random>
  21.  
  22. using namespace std;
  23.  
  24. pair<int, int> qr(vector<int> a) {
  25.     cout << "? ";
  26.     for (auto t : a) {
  27.         cout << t + 1 << ' ';
  28.     }
  29.     cout << endl;
  30.     int pos, x;
  31.     cin >> pos >> x;
  32.     return {x, pos};
  33. }
  34.  
  35. signed main() {
  36.     ios_base::sync_with_stdio(false);
  37.     cin.tie(0);
  38.    
  39.     int n, k;
  40.     cin >> n >> k;
  41.     vector<int> a(k + 1);
  42.     iota(a.begin(), a.end(), 0);
  43.     map<pair<int, int>, int> cnt;
  44.     for (int i = 0; i < k + 1; i++) {
  45.         a.erase(a.begin());
  46.         cnt[qr(a)]++;
  47.         a.push_back(i);
  48.     }
  49.     cout << "! " << cnt.rbegin()->second << endl;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement