結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;

    vector<int> a(n);
    int k = 0;
    for (int i = n - 1; i >= 0; i--) {
        int ans = 0;
        int l = k + i;
        if (l >= 2) {
            cout << "? " << l << '\n';
            for (int j = 0; j < i; j++) {
                cout << j + 1 << ' ';
            }
            for (int j = i + 1; j < n; j++) {
                if (a[j]) cout << j + 1 << ' ';
            }
            cout << endl;

            cin >> ans;
        }
        if (!ans) {
            a[i] = 1;
            k++;
        }
    }

    cout << "! " << k << '\n';
    for (int j = 0; j < n; j++) {
        if (a[j]) cout << j + 1 << ' ';
    }
    cout << endl;

    return 0;
}
0