結果

問題 No.2768 Password Crack
ユーザー srjywrdnprkt
提出日時 2023-12-12 19:47:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 1,856 ms
コンパイル使用メモリ 194,136 KB
最終ジャッジ日時 2025-02-18 10:32:56
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void query(string &S){
    cout << "? " << S << endl;
}
void answer(string &T){
    cout << "! " << T << endl;
}

int main(){

    int N, M;
    cin >> N;
    string S=string(N, 'a');
    for (int i=0; i<N; i++){
        int mi=1e9, mx=0;
        char c='.';
        for (int j=0; j<26; j++){
            S[i] = char('a'+j);
            query(S);
            cin >> M;
            if (M > mx){
                mx = M;
                c = char('a'+j);
            }
            mi = min(mi, M);
        }
        if (mi == mx) c = 'z';
        S[i] = c;
    }

    answer(S);

    return 0;
}
0