結果

問題 No.934 Explosive energy drink
ユーザー fine
提出日時 2019-11-29 22:30:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 169,220 KB
実行使用メモリ 25,220 KB
平均クエリ数 709.58
最終ジャッジ日時 2024-07-16 18:39:01
合計ジャッジ時間 6,602 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

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

    vector<int> ans;
    for (int i = 1; i <= n; i++) {
        cout << "? " << n - 1 << endl;
        for (int j = 1; j <= n; j++) {
            if (j == i) {
                if (j == n) cout << endl;
                continue;
            }

            cout << j;
            if (j == n) cout << endl;
            else cout << " ";
        }

        int query;
        cin >> query;
        if (query == 0) ans.push_back(i);
    }

    cout << "! " << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i];
        if (i + 1 == ans.size()) cout << endl;
        else cout << " ";
    }
    return 0;
}
0