結果
問題 |
No.2768 Password Crack
|
ユーザー |
|
提出日時 | 2024-05-31 22:22:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 982 bytes |
コンパイル時間 | 8,510 ms |
コンパイル使用メモリ | 335,828 KB |
実行使用メモリ | 72,192 KB |
平均クエリ数 | 179.57 |
最終ジャッジ日時 | 2024-12-20 23:57:39 |
合計ジャッジ時間 | 62,201 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 TLE * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) //using mint = modint998244353; const int dx[4]={0,1,0,-1}; const int dy[4]={1,0,-1,0}; int n; int main(){ cin>>n; string ans=""; rep(i,26){ string s=""; rep(j,n)s.push_back(char('a'+i)); cout<<"? "<<s<<endl; int x; cin>>x; rep(j,x)ans.push_back(char('a'+i)); } cout<<"? "<<ans<<endl; int x; cin>>x; int now=x; while(x!=n){ rep(i,n-1){ for(int j=i+1;j<n;j++){ string t=ans; swap(t[i],t[j]); cout<<"? "<<t<<endl; cin>>now; if(x<now){ ans=t; x=now; } if(x==n)break; } } if(x==n)break; } cout<<"! "<<ans<<endl; return 0; }