結果

問題 No.2768 Password Crack
ユーザー テナガザルテナガザル
提出日時 2024-06-13 20:19:26
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 104,224 KB
実行使用メモリ 25,472 KB
平均クエリ数 955.37
最終ジャッジ日時 2024-06-13 20:19:32
合計ジャッジ時間 5,771 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,556 KB
testcase_01 AC 24 ms
25,220 KB
testcase_02 AC 99 ms
24,836 KB
testcase_03 AC 31 ms
25,220 KB
testcase_04 AC 67 ms
25,220 KB
testcase_05 AC 31 ms
24,836 KB
testcase_06 AC 64 ms
25,220 KB
testcase_07 AC 33 ms
24,824 KB
testcase_08 AC 36 ms
24,964 KB
testcase_09 AC 73 ms
24,580 KB
testcase_10 AC 71 ms
24,836 KB
testcase_11 AC 62 ms
24,836 KB
testcase_12 AC 66 ms
24,836 KB
testcase_13 AC 67 ms
24,440 KB
testcase_14 AC 61 ms
24,452 KB
testcase_15 AC 61 ms
24,836 KB
testcase_16 AC 62 ms
25,220 KB
testcase_17 AC 63 ms
25,220 KB
testcase_18 AC 60 ms
25,076 KB
testcase_19 AC 44 ms
24,452 KB
testcase_20 AC 39 ms
24,836 KB
testcase_21 AC 64 ms
25,220 KB
testcase_22 AC 59 ms
24,836 KB
testcase_23 AC 33 ms
24,452 KB
testcase_24 AC 44 ms
25,220 KB
testcase_25 AC 66 ms
24,836 KB
testcase_26 AC 46 ms
25,220 KB
testcase_27 AC 57 ms
24,964 KB
testcase_28 AC 35 ms
25,472 KB
testcase_29 AC 35 ms
24,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	string ans(n, 'a');
	for (int i = 0; i < n; ++i)
	{
		int bs;
		cout << "? " << ans << endl;
		cin >> bs;
		for (char j = 'b'; j <= 'z'; ++j)
		{
			ans[i] = j;
			if (j == 'z') break;
			cout << "? " << ans << endl;
			int tmp;
			cin >> tmp;
			if (bs > tmp)
			{
				ans[i] = 'a';
				break;
			}
			else if (bs < tmp) break;
		}
	}
	cout << "! " << ans << endl;
}
0