結果

問題 No.2154 あさかつの参加人数
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-05 21:47:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 65,816 KB
実行使用メモリ 66,752 KB
最終ジャッジ日時 2023-09-05 21:48:10
合計ジャッジ時間 19,020 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 680 ms
64,684 KB
testcase_01 AC 674 ms
64,668 KB
testcase_02 AC 705 ms
64,816 KB
testcase_03 AC 687 ms
66,752 KB
testcase_04 AC 679 ms
66,720 KB
testcase_05 AC 427 ms
42,980 KB
testcase_06 AC 639 ms
54,164 KB
testcase_07 AC 367 ms
47,520 KB
testcase_08 AC 344 ms
49,216 KB
testcase_09 AC 133 ms
32,532 KB
testcase_10 AC 329 ms
43,216 KB
testcase_11 AC 627 ms
61,496 KB
testcase_12 AC 491 ms
49,244 KB
testcase_13 AC 354 ms
42,440 KB
testcase_14 AC 541 ms
55,332 KB
testcase_15 AC 327 ms
46,064 KB
testcase_16 AC 521 ms
52,924 KB
testcase_17 AC 611 ms
57,704 KB
testcase_18 AC 613 ms
62,276 KB
testcase_19 AC 96 ms
27,592 KB
testcase_20 AC 513 ms
52,668 KB
testcase_21 AC 122 ms
31,668 KB
testcase_22 AC 178 ms
40,096 KB
testcase_23 AC 582 ms
54,456 KB
testcase_24 AC 626 ms
60,504 KB
権限があれば一括ダウンロードができます

ソースコード

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 c = NList;
        var (n, m) = (c[0], c[1]);
        var map = NArr(m);
        var cum = new int[n + 1];
        for (var i = 0; i < m; ++i)
        {
            ++cum[n - map[i][0]];
            --cum[n - map[i][1] + 1];
        }
        for (var i = 1; i < cum.Length; ++i) cum[i] += cum[i - 1];
        WriteLine(string.Join("\n", cum.Take(n)));
    }
}
0