結果
| 問題 | 
                            No.2768 Password Crack
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-05-31 22:07:06 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 219 ms / 2,000 ms | 
| コード長 | 455 bytes | 
| コンパイル時間 | 206 ms | 
| コンパイル使用メモリ | 82,168 KB | 
| 実行使用メモリ | 94,556 KB | 
| 平均クエリ数 | 972.93 | 
| 最終ジャッジ日時 | 2024-12-20 23:37:38 | 
| 合計ジャッジ時間 | 7,509 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 29 | 
ソースコード
from random import shuffle
N = int(input())
l = list("abcdefghijklmnopqrstuvwxyz")
S = ""
for i in range(N):
	shuffle(l)
	cnts = []
	c1 = set()
	for c in l:
		print('?', S + c + 'a' * (N - 1 - i))
		x = int(input())
		cnts.append((x, c))
		c1.add(x)
		if len(cnts) >= 3 and len(c1) == 2:
			cnts.sort()
			c = 0
			for i, _ in cnts:
				if i == cnts[0][0]:
					c += 1
			if c == 1:
				S += cnts[0][1]
			else:
				S += cnts[-1][1]
			break
print('!', S)