結果

問題 No.2768 Password Crack
ユーザー nononnonon
提出日時 2024-05-31 21:57:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 862 bytes
コンパイル時間 2,260 ms
コンパイル使用メモリ 204,776 KB
実行使用メモリ 25,476 KB
平均クエリ数 974.03
最終ジャッジ日時 2024-05-31 21:57:11
合計ジャッジ時間 6,038 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin>>N;
    string alp;
    for(char c='a';c<='z';c++)alp.push_back(c);
    string T(N,'a');
    string S(N,'?');
    mt19937 rng;
    for(int i=0;i<N;i++)
    {
        shuffle(alp.begin(),alp.end(),rng);
        int cnt=-1;
        for(int j=0;j<26;j++)
        {
            T[i]=alp[j];
            cout<<"? "<<T<<endl;
            int n;
            cin>>n;
            if(cnt==-1)cnt=n;
            else if(n!=cnt)
            {
                if(n<cnt)
                {
                    assert(j==1);
                    S[i]=alp[0];
                }
                else
                {
                    S[i]=alp[j];
                }
                break;
            }
        }
    }
    cout<<"! "<<S<<endl;
}
0