結果

問題 No.2768 Password Crack
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-12-12 19:29:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 201,208 KB
実行使用メモリ 25,220 KB
平均クエリ数 1785.17
最終ジャッジ日時 2024-05-31 09:45:58
合計ジャッジ時間 6,587 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,940 KB
testcase_01 AC 21 ms
24,964 KB
testcase_02 AC 88 ms
24,964 KB
testcase_03 AC 88 ms
24,964 KB
testcase_04 AC 85 ms
24,836 KB
testcase_05 AC 28 ms
25,220 KB
testcase_06 AC 87 ms
24,580 KB
testcase_07 AC 97 ms
24,580 KB
testcase_08 AC 38 ms
25,076 KB
testcase_09 AC 84 ms
24,836 KB
testcase_10 AC 89 ms
25,220 KB
testcase_11 AC 85 ms
24,836 KB
testcase_12 AC 83 ms
24,836 KB
testcase_13 AC 92 ms
25,220 KB
testcase_14 AC 90 ms
25,220 KB
testcase_15 AC 88 ms
24,836 KB
testcase_16 AC 87 ms
24,452 KB
testcase_17 AC 106 ms
24,964 KB
testcase_18 AC 87 ms
24,836 KB
testcase_19 AC 55 ms
24,580 KB
testcase_20 AC 52 ms
24,580 KB
testcase_21 AC 86 ms
24,836 KB
testcase_22 AC 71 ms
24,580 KB
testcase_23 AC 32 ms
24,964 KB
testcase_24 AC 48 ms
24,580 KB
testcase_25 AC 86 ms
25,220 KB
testcase_26 AC 48 ms
24,836 KB
testcase_27 AC 69 ms
24,836 KB
testcase_28 AC 33 ms
24,856 KB
testcase_29 AC 47 ms
24,580 KB
権限があれば一括ダウンロードができます

ソースコード

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(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    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<25; 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