結果

問題 No.934 Explosive energy drink
ユーザー takumi152
提出日時 2019-11-29 21:58:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 96,880 KB
最終ジャッジ日時 2025-01-08 05:54:34
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

bool ask(vector<int> &query) {
  sort(query.begin(), query.end());
  cout << "? " << query.size() << endl;
  for (auto &x: query) cout << x << " ";
  cout << endl;
  int response;
  cin >> response;
  return response;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<bool> explosive(n);
  for (int i = 0; i < n; i++) {
    vector<int> query;
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      query.push_back(j+1);
    }
    explosive[i] = !ask(query);
  }

  int k = 0;
  for (auto x: explosive) {
    if (x) k++;
  }

  cout << "! " << k << endl;
  for (int i = 0; i < n; i++) {
    if (explosive[i]) cout << i+1 << " ";
  }
  cout << endl;

  return 0;
}
0