結果
問題 | No.305 鍵(2) |
ユーザー |
![]() |
提出日時 | 2015-11-27 23:18:44 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 1,215 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 83,992 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 86.69 |
最終ジャッジ日時 | 2024-07-16 21:50:11 |
合計ジャッジ時間 | 1,956 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <vector>#include <map>#include <set>#include <stack>#include <queue>#include <functional>#include <cmath>#ifndef ONLINE_JUDGE# include <complex># include <random># include <array># include <unordered_map># define mkt make_tuple#endif#ifdef _LOCAL# include "module/for_local.h"#else# define assert(...) ((void)0)# define ifdebug if (false)# define echo(...) ((void)0)#endifusing namespace std;typedef long long ll; typedef unsigned long long ull;#define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I))#define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I))#define all(_X) (_X).begin(), (_X).end()string key = "0000000000";pair<int, bool> query(){cout << key << endl;int n;static char msg[10] {};cin >> n >> msg;return { n, ! strcmp(msg, "unlocked") };}int main(){int n;bool unlocked;rep(i, 10){int ma = 0;char ma_d = '0';for ( char d = '0'; d <= '9'; d++ ){key[i] = d;tie(n, unlocked) = query();if ( unlocked ) return 0;if ( ma < n ) {ma = n;ma_d = d;}}key[i] = ma_d;}query();return 0;}