結果
| 問題 | No.355 数当てゲーム(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 17:04:53 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 988 bytes |
| 記録 | |
| コンパイル時間 | 1,044 ms |
| コンパイル使用メモリ | 100,260 KB |
| 実行使用メモリ | 30,308 KB |
| 平均クエリ数 | 21.04 |
| 最終ジャッジ日時 | 2026-06-10 08:11:50 |
| 合計ジャッジ時間 | 8,958 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 33 |
ソースコード
#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;
}