結果

問題 No.355 数当てゲーム(2)
ユーザー Mister
提出日時 2020-05-29 16:58:26
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 648 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 106,376 KB
最終ジャッジ日時 2025-01-10 16:13:11
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#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;
}

void solve() {
    std::vector<int> xs;
    for (int d = 0; d <= 9; ++d) {
        int p = query(std::vector<int>(4, d));
        while (p--) {
            xs.push_back(d);
        }
    }

    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