結果

問題 No.934 Explosive energy drink
ユーザー Mister
提出日時 2020-04-21 19:41:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 444 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 1,313 ms
コンパイル使用メモリ 75,732 KB
最終ジャッジ日時 2025-01-09 22:06:07
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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