結果

問題 No.2768 Password Crack
ユーザー Tatsu_mrTatsu_mr
提出日時 2024-06-01 01:18:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 861 bytes
コンパイル時間 2,259 ms
コンパイル使用メモリ 206,328 KB
実行使用メモリ 25,460 KB
平均クエリ数 1785.17
最終ジャッジ日時 2024-06-01 01:18:20
合計ジャッジ時間 6,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
25,196 KB
testcase_01 AC 26 ms
24,656 KB
testcase_02 AC 100 ms
24,824 KB
testcase_03 AC 100 ms
25,348 KB
testcase_04 AC 99 ms
24,964 KB
testcase_05 AC 34 ms
24,964 KB
testcase_06 AC 99 ms
24,836 KB
testcase_07 AC 99 ms
24,964 KB
testcase_08 AC 46 ms
25,220 KB
testcase_09 AC 100 ms
25,220 KB
testcase_10 AC 99 ms
24,964 KB
testcase_11 AC 99 ms
25,220 KB
testcase_12 AC 100 ms
24,580 KB
testcase_13 AC 99 ms
25,240 KB
testcase_14 AC 100 ms
24,836 KB
testcase_15 AC 99 ms
25,220 KB
testcase_16 AC 99 ms
25,448 KB
testcase_17 AC 100 ms
25,460 KB
testcase_18 AC 99 ms
24,964 KB
testcase_19 AC 64 ms
25,348 KB
testcase_20 AC 62 ms
24,836 KB
testcase_21 AC 98 ms
25,220 KB
testcase_22 AC 81 ms
24,836 KB
testcase_23 AC 40 ms
24,836 KB
testcase_24 AC 56 ms
24,568 KB
testcase_25 AC 95 ms
24,964 KB
testcase_26 AC 58 ms
24,836 KB
testcase_27 AC 83 ms
24,964 KB
testcase_28 AC 41 ms
25,220 KB
testcase_29 AC 48 ms
24,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int n;
    cin >> n;
    vector<char> ans(n);
    for (int i = 0; i < n; i++) {
        vector<int> num;
        string ask = "";
        for (int j = 0; j < n; j++) {
            ask += "a";
        }
        for (char c = 'a'; c < 'z'; c++) {
            ask[i] = c;
            cout << "? " << ask << endl;
            int cnt;
            cin >> cnt;
            num.push_back(cnt);
        }
        int id = max_element(num.begin(), num.end()) - num.begin();
        bool same = true;
        for (int j = 0; j < (int)num.size() - 1; j++) {
            if (num[j] != num[j + 1]) {
                same = false;
            }
        }
        ans[i] = (same ? 'z' : (char)(id + 97));
    }
    cout << "! ";
    for (auto c : ans) {
        cout << c;
    }
    cout << endl;
    return 0;
}
0