結果
問題 |
No.2768 Password Crack
|
ユーザー |
|
提出日時 | 2024-05-31 21:39:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 651 bytes |
コンパイル時間 | 733 ms |
コンパイル使用メモリ | 67,232 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 791.23 |
最終ジャッジ日時 | 2024-12-20 22:51:59 |
合計ジャッジ時間 | 7,789 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 22 RE * 2 |
ソースコード
#include<iostream> #include<cassert> using namespace std; int ask(string T) { cout<<"? "<<T<<endl; int r;cin>>r; return r; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N;cin>>N; string T(N,'a'); int base=ask(T); for(int i=0;i<N;i++) { T[i]='b'; int now=ask(T); assert(abs(base-now)<=1); if(base>now) { T[i]='a'; continue; } if(base<now) { base=now; continue; } bool fn=false; for(char c='c';c<='y';c++) { T[i]=c; int now=ask(T); assert(base<=now&&now<=base+1); if(base<now) { base=now; fn=true; break; } } if(!fn)T[i]='z'; } cout<<"! "<<T<<endl; }