結果

問題 No.2796 Small Matryoshka
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-28 21:52:52
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 370 ms / 2,000 ms
コード長 1,107 bytes
コンパイル時間 9,866 ms
コンパイル使用メモリ 167,316 KB
実行使用メモリ 220,028 KB
最終ジャッジ日時 2024-06-28 21:53:12
合計ジャッジ時間 14,982 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
30,556 KB
testcase_01 AC 60 ms
30,336 KB
testcase_02 AC 58 ms
30,336 KB
testcase_03 AC 58 ms
30,080 KB
testcase_04 AC 59 ms
30,464 KB
testcase_05 AC 98 ms
39,808 KB
testcase_06 AC 326 ms
68,216 KB
testcase_07 AC 63 ms
30,336 KB
testcase_08 AC 283 ms
67,168 KB
testcase_09 AC 370 ms
70,012 KB
testcase_10 AC 360 ms
69,780 KB
testcase_11 AC 358 ms
69,644 KB
testcase_12 AC 163 ms
54,784 KB
testcase_13 AC 74 ms
34,024 KB
testcase_14 AC 148 ms
51,816 KB
testcase_15 AC 85 ms
37,120 KB
testcase_16 AC 105 ms
41,600 KB
testcase_17 AC 235 ms
62,484 KB
testcase_18 AC 275 ms
67,168 KB
testcase_19 AC 121 ms
44,288 KB
testcase_20 AC 142 ms
48,896 KB
testcase_21 AC 241 ms
220,028 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (98 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 map = NArr(n);
        WriteLine(Mat(n, map));
    }
    static int Mat(int n, int[][] map)
    {
        var elist = new List<(int l, int f)>();
        foreach (var m in map)
        {
            elist.Add((m[0], 1));
            elist.Add((m[1], -1));
        }
        elist.Sort((l, r) =>
        {
            var d = l.l.CompareTo(r.l);
            if (d != 0) return d;
            return l.f.CompareTo(r.f);
        });
        var ans = 0;
        var tmp = 0;
        foreach (var e in elist)
        {
            tmp += e.f;
            ans = Math.Max(ans, tmp);
        }
        return ans - 1;
    }
}
0