結果

問題 No.1619 Coccinellidae
ユーザー 👑 kakel-sankakel-san
提出日時 2021-07-22 22:21:15
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 67,924 KB
実行使用メモリ 33,292 KB
最終ジャッジ日時 2023-09-24 17:31:12
合計ジャッジ時間 6,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
24,536 KB
testcase_01 WA -
testcase_02 AC 93 ms
29,504 KB
testcase_03 AC 64 ms
24,684 KB
testcase_04 WA -
testcase_05 AC 79 ms
24,092 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
28,004 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 87 ms
28,580 KB
testcase_12 AC 63 ms
22,652 KB
testcase_13 WA -
testcase_14 AC 91 ms
29,760 KB
testcase_15 AC 63 ms
22,496 KB
testcase_16 AC 64 ms
22,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class yuki1
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var c = ReadLine().Split();
        var n = int.Parse(c[0]);
        var m = long.Parse(c[1]);
        var k = long.Parse(c[2]);

        var rlist = new HashSet<int>();
        var tmp = k;
        for (var i = n - 1; i >= 0; --i)
        {
            if (tmp > 0 && tmp >= i)
            {
                rlist.Add(n - i);
                tmp -= i;
            }
        }
        var list = new List<long>(n);
        for (var i = 1; i <= n; ++i)
        {
            if (!rlist.Contains(i)) list.Add(i);
        }
        list[list.Count - 1] += m - (long)n * (n + 1) / 2;
        for (var i = n; i > 0; --i)
        {
            if (rlist.Contains(i)) list.Add(i);
        }
        WriteLine(string.Join("\n", list));
    }
}
0