結果

問題 No.2768 Password Crack
ユーザー karinohitokarinohito
提出日時 2024-09-04 22:27:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 2,593 ms
コンパイル使用メモリ 208,736 KB
実行使用メモリ 25,220 KB
平均クエリ数 966.77
最終ジャッジ日時 2024-09-04 22:27:13
合計ジャッジ時間 6,582 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
25,196 KB
testcase_01 AC 24 ms
24,580 KB
testcase_02 AC 64 ms
25,220 KB
testcase_03 AC 64 ms
24,964 KB
testcase_04 AC 66 ms
24,836 KB
testcase_05 AC 28 ms
24,836 KB
testcase_06 AC 66 ms
24,580 KB
testcase_07 AC 68 ms
24,836 KB
testcase_08 AC 35 ms
24,580 KB
testcase_09 AC 63 ms
24,580 KB
testcase_10 AC 66 ms
24,580 KB
testcase_11 AC 69 ms
24,952 KB
testcase_12 AC 63 ms
24,820 KB
testcase_13 AC 63 ms
24,580 KB
testcase_14 AC 65 ms
24,964 KB
testcase_15 AC 65 ms
24,836 KB
testcase_16 AC 64 ms
24,964 KB
testcase_17 AC 67 ms
25,220 KB
testcase_18 AC 65 ms
24,580 KB
testcase_19 AC 44 ms
24,836 KB
testcase_20 AC 41 ms
24,964 KB
testcase_21 AC 62 ms
24,580 KB
testcase_22 AC 57 ms
24,836 KB
testcase_23 AC 32 ms
25,220 KB
testcase_24 AC 42 ms
24,580 KB
testcase_25 AC 91 ms
25,220 KB
testcase_26 AC 41 ms
24,580 KB
testcase_27 AC 55 ms
24,836 KB
testcase_28 AC 30 ms
24,964 KB
testcase_29 AC 35 ms
24,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N;
    cin>>N;
    string S="";
    for(int i=0;i<N;i++)S.push_back(rand()%26+'a');
    cout<<"? "<<S<<endl;
    int R;
    cin>>R;
    string AN="";
    for(int i=0;i<N;i++){
        set<char> D;
        D.insert(S[i]);
        bool OK=0;
        for(int k=0;k<25;k++){
            char c=S[i];
            while(D.count(c))c=rand()%26+'a';
            D.insert(c);
            string Q=S;
            Q[i]=c;
            cout<<"? "<<Q<<endl;
            int r;
            cin>>r;
            if(R<r){
                AN.push_back(c);
                OK=1;
                break;
            }
        }
        if(!OK)AN.push_back(S[i]);
    }
    cout<<"! "<<AN<<endl;
}
0