結果
| 問題 |
No.2768 Password Crack
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-05-31 21:57:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 862 bytes |
| コンパイル時間 | 2,204 ms |
| コンパイル使用メモリ | 197,048 KB |
| 最終ジャッジ日時 | 2025-02-21 17:49:15 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 29 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
string alp;
for(char c='a';c<='z';c++)alp.push_back(c);
string T(N,'a');
string S(N,'?');
mt19937 rng;
for(int i=0;i<N;i++)
{
shuffle(alp.begin(),alp.end(),rng);
int cnt=-1;
for(int j=0;j<26;j++)
{
T[i]=alp[j];
cout<<"? "<<T<<endl;
int n;
cin>>n;
if(cnt==-1)cnt=n;
else if(n!=cnt)
{
if(n<cnt)
{
assert(j==1);
S[i]=alp[0];
}
else
{
S[i]=alp[j];
}
break;
}
}
}
cout<<"! "<<S<<endl;
}
nonon