結果

問題 No.2768 Password Crack
ユーザー 👑 kakel-sankakel-san
提出日時 2024-05-31 22:11:48
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 1,300 bytes
コンパイル時間 8,880 ms
コンパイル使用メモリ 169,776 KB
実行使用メモリ 46,560 KB
平均クエリ数 885.97
最終ジャッジ日時 2024-05-31 22:12:02
合計ジャッジ時間 13,376 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
45,272 KB
testcase_01 AC 77 ms
45,280 KB
testcase_02 AC 155 ms
46,560 KB
testcase_03 AC 78 ms
45,792 KB
testcase_04 AC 117 ms
45,792 KB
testcase_05 AC 81 ms
45,408 KB
testcase_06 AC 114 ms
45,664 KB
testcase_07 AC 82 ms
45,664 KB
testcase_08 AC 86 ms
45,408 KB
testcase_09 AC 115 ms
46,432 KB
testcase_10 AC 121 ms
46,304 KB
testcase_11 AC 120 ms
46,008 KB
testcase_12 AC 126 ms
46,048 KB
testcase_13 AC 124 ms
46,560 KB
testcase_14 AC 120 ms
46,176 KB
testcase_15 AC 114 ms
45,792 KB
testcase_16 AC 115 ms
45,920 KB
testcase_17 AC 120 ms
46,176 KB
testcase_18 AC 120 ms
46,176 KB
testcase_19 AC 96 ms
45,920 KB
testcase_20 AC 95 ms
46,304 KB
testcase_21 AC 115 ms
46,016 KB
testcase_22 AC 111 ms
46,176 KB
testcase_23 AC 85 ms
45,280 KB
testcase_24 AC 97 ms
45,648 KB
testcase_25 AC 119 ms
46,176 KB
testcase_26 AC 99 ms
46,048 KB
testcase_27 AC 109 ms
45,880 KB
testcase_28 AC 84 ms
45,536 KB
testcase_29 AC 88 ms
45,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var r = new Random();
        var init = new char[n];
        for (var i = 0; i < n; ++i) init[i] = (char)(r.Next(26) + 'a');
        var ix = Q(init);
        var ans = (char[]) init.Clone();
        for (var i = 0; i < n; ++i)
        {
            for (var j = 'a'; j <= 'z'; ++j)
            {
                if (j == init[i]) continue;
                var tmp = init[i];
                init[i] = j;
                var nx = Q(init);
                init[i] = tmp;
                if (nx < ix) break;
                if (nx > ix)
                {
                    ans[i] = j;
                    break;
                }
            }
        }
        WriteLine($"! {string.Concat(ans)}");
    }
    static int Q(char[] s)
    {
        WriteLine($"? {string.Concat(s)}");
        return NN;
    }
}
0