結果

問題 No.1995 CHIKA Road
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-27 23:40:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 1,632 ms
コンパイル使用メモリ 65,844 KB
実行使用メモリ 32,236 KB
最終ジャッジ日時 2023-09-27 23:40:48
合計ジャッジ時間 12,155 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,796 KB
testcase_01 AC 65 ms
21,716 KB
testcase_02 AC 65 ms
21,964 KB
testcase_03 AC 65 ms
23,788 KB
testcase_04 AC 64 ms
21,756 KB
testcase_05 AC 65 ms
21,816 KB
testcase_06 AC 78 ms
25,916 KB
testcase_07 AC 133 ms
26,252 KB
testcase_08 AC 67 ms
21,816 KB
testcase_09 AC 67 ms
21,856 KB
testcase_10 AC 189 ms
29,760 KB
testcase_11 AC 218 ms
29,708 KB
testcase_12 AC 207 ms
32,136 KB
testcase_13 AC 116 ms
28,908 KB
testcase_14 AC 144 ms
24,840 KB
testcase_15 AC 195 ms
29,616 KB
testcase_16 AC 85 ms
23,868 KB
testcase_17 AC 152 ms
27,864 KB
testcase_18 AC 212 ms
30,092 KB
testcase_19 AC 207 ms
32,236 KB
testcase_20 AC 141 ms
29,824 KB
testcase_21 AC 138 ms
29,972 KB
testcase_22 AC 198 ms
31,528 KB
testcase_23 AC 106 ms
26,260 KB
testcase_24 AC 182 ms
29,376 KB
testcase_25 AC 89 ms
26,412 KB
testcase_26 AC 112 ms
28,996 KB
testcase_27 AC 177 ms
26,852 KB
testcase_28 AC 136 ms
27,760 KB
testcase_29 AC 203 ms
31,480 KB
testcase_30 AC 86 ms
23,876 KB
testcase_31 AC 79 ms
21,928 KB
testcase_32 AC 94 ms
24,356 KB
testcase_33 AC 173 ms
28,668 KB
testcase_34 AC 76 ms
23,740 KB
testcase_35 AC 110 ms
28,340 KB
testcase_36 AC 117 ms
27,076 KB
testcase_37 AC 200 ms
29,420 KB
testcase_38 AC 155 ms
27,888 KB
testcase_39 AC 74 ms
21,828 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);
        Array.Sort(map, (l, r) => l[1].CompareTo(r[1]));
        var pos = 1;
        var ans = 2 * n - 2;
        for (var i = 0; i < m; ++i)
        {
            if (pos <= map[i][0])
            {
                pos = map[i][1];
                --ans;
            }
        }
        WriteLine(ans);
    }
}
0