結果

問題 No.2768 Password Crack
ユーザー GOTKAKOGOTKAKO
提出日時 2024-05-31 21:41:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 202,164 KB
実行使用メモリ 25,220 KB
平均クエリ数 885.00
最終ジャッジ日時 2024-05-31 21:42:00
合計ジャッジ時間 5,282 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
24,940 KB
testcase_01 AC 20 ms
24,964 KB
testcase_02 AC 91 ms
24,964 KB
testcase_03 AC 30 ms
24,964 KB
testcase_04 AC 57 ms
24,580 KB
testcase_05 AC 26 ms
25,220 KB
testcase_06 AC 56 ms
24,580 KB
testcase_07 AC 28 ms
24,580 KB
testcase_08 AC 32 ms
25,220 KB
testcase_09 AC 58 ms
25,220 KB
testcase_10 AC 60 ms
24,580 KB
testcase_11 AC 59 ms
24,836 KB
testcase_12 AC 60 ms
24,568 KB
testcase_13 AC 65 ms
25,220 KB
testcase_14 AC 58 ms
24,964 KB
testcase_15 AC 56 ms
24,580 KB
testcase_16 AC 63 ms
24,964 KB
testcase_17 AC 57 ms
25,220 KB
testcase_18 AC 59 ms
24,580 KB
testcase_19 AC 43 ms
24,836 KB
testcase_20 AC 39 ms
24,964 KB
testcase_21 AC 61 ms
24,580 KB
testcase_22 AC 52 ms
24,836 KB
testcase_23 AC 30 ms
24,580 KB
testcase_24 AC 39 ms
25,220 KB
testcase_25 AC 55 ms
24,836 KB
testcase_26 AC 40 ms
24,580 KB
testcase_27 AC 51 ms
24,836 KB
testcase_28 AC 32 ms
24,580 KB
testcase_29 AC 35 ms
24,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    string s(N,'a');
    int S;
    cout << "? " << s << endl;
    cin >> S;
    string answer = "";
    for(int i=0; i<N; i++){
        bool add = false;
        for(char c='b'; c<='y'; c++){
            s.at(i) = c;
            cout << "? " << s << endl;
            int now; cin >> now;
            if(S == now+1){
                add = true;
                answer += 'a'; break;
            }
            if(now == S+1){
                add = true;
                answer += c; break;
            }
        }
        if(add == false) answer += 'z';
        s.at(i) = 'a';
    }
    cout << "! " << answer << endl;
}
0