結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー 👑 kakel-sankakel-san
提出日時 2024-08-23 21:41:00
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,241 bytes
コンパイル時間 8,039 ms
コンパイル使用メモリ 167,852 KB
実行使用メモリ 221,488 KB
最終ジャッジ日時 2024-08-23 21:41:13
合計ジャッジ時間 12,064 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
30,720 KB
testcase_01 WA -
testcase_02 AC 84 ms
48,000 KB
testcase_03 AC 59 ms
30,968 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 66 ms
32,640 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 58 ms
31,488 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 61 ms
31,104 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 99 ms
51,688 KB
testcase_22 AC 313 ms
221,488 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 t = NN;
        var ans = new string[t];
        for (var u = 0; u < t; ++u)
        {
            var c = NList;
            ans[u] = Cal(c[0], c[1], c[2]);
        }
        WriteLine(string.Join("\n", ans));
    }
    static string Cal(int k, int m, int n)
    {
        if (n * 2 > k) return "No";
        if (m == 1) return "No";
        var d = m - 1;
        if (d > k / 2) d = k - d;
        var ans = new List<int>();
        var set = new HashSet<int>();
        for (var i = 0; i < k; ++i)
        {
            if (i / d % 2 == 1) continue;
            if (!set.Add(i) || !set.Add((i + d) % k)) return "No";
            ans.Add(i);
            if (set.Count == n * 2) break;
        }
        return $"Yes\n{string.Join(" ", ans.Select(ai => ai + 1))}";
    }
}
0