結果

問題 No.934 Explosive energy drink
ユーザー kk
提出日時 2020-07-27 21:05:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 802 bytes
コンパイル時間 2,038 ms
コンパイル使用メモリ 202,576 KB
実行使用メモリ 24,396 KB
平均クエリ数 709.58
最終ジャッジ日時 2023-09-24 03:57:17
合計ジャッジ時間 6,053 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,832 KB
testcase_01 AC 278 ms
24,348 KB
testcase_02 AC 20 ms
24,012 KB
testcase_03 AC 142 ms
23,676 KB
testcase_04 AC 280 ms
23,652 KB
testcase_05 AC 20 ms
23,640 KB
testcase_06 AC 19 ms
23,868 KB
testcase_07 AC 19 ms
23,628 KB
testcase_08 AC 20 ms
23,640 KB
testcase_09 AC 22 ms
23,412 KB
testcase_10 AC 24 ms
24,012 KB
testcase_11 AC 23 ms
23,532 KB
testcase_12 AC 25 ms
23,376 KB
testcase_13 AC 23 ms
24,012 KB
testcase_14 AC 24 ms
24,396 KB
testcase_15 AC 90 ms
24,396 KB
testcase_16 AC 37 ms
23,448 KB
testcase_17 AC 55 ms
24,372 KB
testcase_18 AC 57 ms
23,628 KB
testcase_19 AC 106 ms
23,412 KB
testcase_20 AC 180 ms
23,532 KB
testcase_21 AC 192 ms
24,000 KB
testcase_22 AC 270 ms
23,628 KB
testcase_23 AC 275 ms
23,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int ask(int x, int n) {
  cout << "? " << (n-1) << endl;
  REP (i, n) {
    if (i != x)
      cout << i+1 << " ";
  }
  cout << endl;
  cout.flush();
  int r;
  cin >> r;
  return r;
}

void answer(const vector<int> &v) {
  cout << "! " << v.size() << endl;
  for (auto x: v)
    cout << x+1 << " ";
  cout << endl;
  cout.flush();
}

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

  int n;
  cin >> n;

  vector<int> needed(n);

  REP (i, n)
    needed[i] = !ask(i, n);

  vector<int> ret;
  REP (i, n) if (needed[i]) ret.push_back(i);
  answer(ret);
  
  return 0;
}
0