結果
問題 | No.305 鍵(2) |
ユーザー |
![]() |
提出日時 | 2018-01-07 02:01:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,206 bytes |
コンパイル時間 | 993 ms |
コンパイル使用メモリ | 71,332 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 5419.92 |
最終ジャッジ日時 | 2024-07-16 15:21:04 |
合計ジャッジ時間 | 9,442 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 3 -- * 7 |
ソースコード
#include <iostream>#include <tuple>using namespace std;int ask(std::string S){std::cout << S << std::endl;int N;std::string T;std::cin >> N >> T;return N;}string find(string prefix, string suffix){for(int i=0;i<100000;++i){string s = to_string(i);while(s.size() < 5){s = '0' + s;}if(ask(prefix + s + suffix) == 5){return s;}}return "-1";}int main(){string notMatchedSuffix;{int matched = 100;for(int i=0;i<10;++i){string s = string(5, '0' + i);int n = ask(string(5, '0') + s);if(n < matched){notMatchedSuffix = s;matched = n;}}}string notMatchedPrefix;{int matched = 100;for(int i=0;i<10;++i){string s = string(5, '0' + i);int n = ask(s + string(5, '0'));if(n < matched){notMatchedPrefix = s;matched = n;}}}string res = find("", notMatchedSuffix) + find(notMatchedPrefix, "");std::cout << res << std::endl;}