結果

問題 No.2768 Password Crack
ユーザー Carpenters-Cat
提出日時 2024-05-31 22:32:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 193,700 KB
最終ジャッジ日時 2025-02-21 18:07:59
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
	int N;
	cin >> N;
	string T('a', N);
	for (int i = 0; i < N; i ++) {
		int x;
		cout << "? " << T << endl;
		cin >> x;
		bool did = false;
		for (char j = 'b'; j < 'z'; j ++) {
			T[i] = j;
			cout << "? " << T << endl;
			int y;
			cin >> y;
			did = did || (x != y);
			if (x > y) {
				T[i] = 'a';
				break;
			} else if (x < y) {
				break;
			}
		}
		if (!did) T[i] = 'z';
	}
	cout << "! " << T << endl;
	return 0;
}
0