結果

問題 No.355 数当てゲーム(2)
ユーザー MisterMister
提出日時 2020-05-29 17:04:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 988 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 24,540 KB
平均クエリ数 21.04
最終ジャッジ日時 2023-09-24 03:38:32
合計ジャッジ時間 11,399 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,412 KB
testcase_01 AC 27 ms
24,372 KB
testcase_02 WA -
testcase_03 AC 26 ms
23,640 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 27 ms
23,232 KB
testcase_07 AC 26 ms
23,604 KB
testcase_08 AC 26 ms
23,616 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 26 ms
24,024 KB
testcase_14 WA -
testcase_15 AC 26 ms
24,240 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 26 ms
23,820 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 25 ms
23,640 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 26 ms
23,688 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 25 ms
24,312 KB
testcase_32 AC 26 ms
23,424 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 25 ms
23,472 KB
testcase_36 AC 26 ms
23,436 KB
testcase_37 AC 25 ms
23,724 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 26 ms
23,592 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 26 ms
24,000 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 25 ms
24,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

int query(const std::vector<int>& xs) {
    for (auto x : xs) std::cout << x << " ";
    std::cout << std::endl;

    int a, b;
    std::cin >> a >> b;
    if (a == 4) std::exit(0);
    return a + b;
}

void solve() {
    std::vector<int> xs;

    std::vector<int> ys(4);
    std::iota(ys.begin(), ys.end(), 0);
    int b = query(ys);

    for (int d = 4; d <= 9; ++d) {
        ys.back() = d;
        if (query(ys) > b) xs.push_back(d);
    }

    std::iota(ys.begin(), ys.end(), 6);
    b = query(ys);
    for (int d = 0; d < 6; ++d) {
        ys.front() = d;
        if (query(ys) > b) xs.push_back(d);
    }

    std::sort(xs.begin(), xs.end());
    xs.erase(std::unique(xs.begin(), xs.end()), xs.end());

    do {
        query(xs);
    } while (std::next_permutation(xs.begin(), xs.end()));
}

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

    solve();

    return 0;
}
0