結果

問題 No.934 Explosive energy drink
ユーザー MisterMister
提出日時 2020-04-21 19:41:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 884 ms
コンパイル使用メモリ 79,452 KB
実行使用メモリ 24,420 KB
平均クエリ数 709.08
最終ジャッジ日時 2023-09-24 03:19:56
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
23,400 KB
testcase_01 AC 191 ms
23,640 KB
testcase_02 AC 25 ms
24,084 KB
testcase_03 AC 106 ms
23,592 KB
testcase_04 AC 322 ms
23,556 KB
testcase_05 AC 26 ms
23,880 KB
testcase_06 AC 25 ms
23,976 KB
testcase_07 AC 25 ms
23,652 KB
testcase_08 AC 26 ms
23,364 KB
testcase_09 AC 26 ms
24,048 KB
testcase_10 AC 26 ms
24,336 KB
testcase_11 AC 26 ms
23,460 KB
testcase_12 AC 28 ms
23,844 KB
testcase_13 AC 30 ms
23,412 KB
testcase_14 AC 33 ms
23,892 KB
testcase_15 AC 108 ms
23,712 KB
testcase_16 AC 39 ms
23,532 KB
testcase_17 AC 52 ms
24,048 KB
testcase_18 AC 55 ms
24,420 KB
testcase_19 AC 87 ms
23,592 KB
testcase_20 AC 139 ms
23,376 KB
testcase_21 AC 141 ms
23,832 KB
testcase_22 AC 191 ms
24,324 KB
testcase_23 AC 192 ms
23,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>

bool query(const std::set<int>& xs, int ty) {
    if (xs.size() < 2) return false;

    std::cout << "?!"[ty] << " " << xs.size() << std::endl;
    for (auto x : xs) std::cout << x << " ";
    std::cout << std::endl;

    if (ty == 1) return true;

    bool res;
    std::cin >> res;
    return res;
}

void solve() {
    int n;
    std::cin >> n;

    std::set<int> xs;
    for (int i = 1; i <= n; ++i) xs.insert(i);

    for (int i = 1; i <= n; ++i) {
        xs.erase(i);
        if (!query(xs, 0)) xs.insert(i);
    }

    query(xs, 1);
}

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

    solve();

    return 0;
}
0