結果
問題 | No.305 鍵(2) |
ユーザー | Mister |
提出日時 | 2020-04-13 22:00:05 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 666 bytes |
コンパイル時間 | 567 ms |
コンパイル使用メモリ | 69,048 KB |
実行使用メモリ | 24,384 KB |
平均クエリ数 | 86.69 |
最終ジャッジ日時 | 2023-09-24 02:34:32 |
合計ジャッジ時間 | 1,762 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
23,376 KB |
testcase_01 | AC | 23 ms
23,784 KB |
testcase_02 | AC | 26 ms
23,952 KB |
testcase_03 | AC | 27 ms
24,012 KB |
testcase_04 | AC | 23 ms
24,036 KB |
testcase_05 | AC | 23 ms
23,556 KB |
testcase_06 | AC | 21 ms
24,384 KB |
testcase_07 | AC | 23 ms
23,388 KB |
testcase_08 | AC | 22 ms
24,276 KB |
testcase_09 | AC | 23 ms
23,400 KB |
testcase_10 | AC | 24 ms
24,288 KB |
testcase_11 | AC | 23 ms
23,388 KB |
testcase_12 | AC | 22 ms
23,376 KB |
ソースコード
#include <iostream> #include <string> int query(const std::string& s) { std::cout << s << std::endl; int x; std::string t; std::cin >> x >> t; if (x == 10) std::exit(0); return x; } void solve() { std::string s(10, '0'); for (int i = 0; i < 10; ++i) { int x = -1, max = -1; for (int c = 0; c <= 9; ++c) { s[i] = '0' + c; int res = query(s); if (res > max) { max = res; x = c; } } s[i] = '0' + x; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }