結果

問題 No.934 Explosive energy drink
ユーザー takumi152takumi152
提出日時 2019-11-29 21:58:38
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 100,188 KB
実行使用メモリ 24,312 KB
平均クエリ数 709.58
最終ジャッジ日時 2023-09-23 18:26:47
合計ジャッジ時間 5,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,616 KB
testcase_01 AC 307 ms
23,400 KB
testcase_02 AC 24 ms
24,000 KB
testcase_03 AC 158 ms
23,556 KB
testcase_04 AC 318 ms
23,376 KB
testcase_05 AC 25 ms
23,832 KB
testcase_06 AC 24 ms
23,616 KB
testcase_07 AC 25 ms
23,820 KB
testcase_08 AC 25 ms
24,264 KB
testcase_09 AC 25 ms
23,964 KB
testcase_10 AC 25 ms
23,796 KB
testcase_11 AC 24 ms
24,288 KB
testcase_12 AC 26 ms
23,832 KB
testcase_13 AC 30 ms
23,412 KB
testcase_14 AC 30 ms
24,312 KB
testcase_15 AC 104 ms
24,024 KB
testcase_16 AC 43 ms
24,012 KB
testcase_17 AC 64 ms
24,300 KB
testcase_18 AC 65 ms
23,364 KB
testcase_19 AC 124 ms
23,412 KB
testcase_20 AC 201 ms
23,364 KB
testcase_21 AC 225 ms
23,424 KB
testcase_22 AC 299 ms
23,508 KB
testcase_23 AC 311 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

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