結果

問題 No.934 Explosive energy drink
ユーザー merom686merom686
提出日時 2019-11-29 22:26:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 880 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 76,004 KB
実行使用メモリ 24,396 KB
平均クエリ数 709.42
最終ジャッジ日時 2023-09-23 18:47:11
合計ジャッジ時間 4,850 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
24,336 KB
testcase_01 AC 185 ms
23,316 KB
testcase_02 AC 27 ms
23,544 KB
testcase_03 AC 103 ms
24,084 KB
testcase_04 AC 312 ms
23,544 KB
testcase_05 AC 27 ms
24,276 KB
testcase_06 AC 27 ms
23,964 KB
testcase_07 AC 27 ms
23,748 KB
testcase_08 AC 27 ms
24,264 KB
testcase_09 AC 27 ms
23,460 KB
testcase_10 AC 27 ms
23,472 KB
testcase_11 AC 28 ms
23,976 KB
testcase_12 AC 30 ms
23,964 KB
testcase_13 AC 31 ms
24,396 KB
testcase_14 AC 33 ms
24,288 KB
testcase_15 AC 106 ms
24,288 KB
testcase_16 AC 38 ms
23,460 KB
testcase_17 AC 51 ms
24,096 KB
testcase_18 AC 55 ms
23,736 KB
testcase_19 AC 84 ms
23,736 KB
testcase_20 AC 133 ms
23,712 KB
testcase_21 AC 136 ms
23,304 KB
testcase_22 AC 184 ms
24,168 KB
testcase_23 AC 187 ms
23,712 KB
権限があれば一括ダウンロードができます

ソースコード

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