結果

問題 No.2768 Password Crack
ユーザー kaede2020
提出日時 2024-05-31 23:35:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 6,729 ms
コンパイル使用メモリ 336,452 KB
実行使用メモリ 25,832 KB
平均クエリ数 73.37
最終ジャッジ日時 2024-12-21 01:54:04
合計ジャッジ時間 13,739 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 1 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 ok[111];
int main(){
    cin>>n;
    string ans="";
    rep(i,n)ans.push_back('a');
    int cnt=2500;
    cout<<"? "<<ans<<endl;
    int x;
    cin>>x;
    cnt--;
    int now=x;
    rep(j,26){
        rep(i,n){  
            if(cnt<=0)break;  
            if(ok[i])continue;
            string t=ans;
            t[i]=(char)('a'+j);
            cout<<"? "<<t<<endl;
            int x;
            cin>>x;
            cnt--;
            if(x-now==1){
                ok[i]=1;
                now=x;
                ans=t;
            }
        }
        if(now==x)break;
    }
    if(now!=x)rep(i,n)if(ok[i]==0)ans[i]='z';
    cout<<"! "<<ans<<endl;
    return 0;
}
0