結果

問題 No.1703 Much Matching
ユーザー 👑 kakel-sankakel-san
提出日時 2023-12-30 20:16:36
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 808 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 12,770 ms
コンパイル使用メモリ 158,524 KB
実行使用メモリ 185,460 KB
最終ジャッジ日時 2023-12-30 20:16:59
合計ジャッジ時間 15,427 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
32,676 KB
testcase_01 AC 76 ms
32,676 KB
testcase_02 AC 75 ms
32,676 KB
testcase_03 AC 88 ms
34,212 KB
testcase_04 AC 78 ms
33,956 KB
testcase_05 AC 80 ms
35,492 KB
testcase_06 AC 256 ms
65,596 KB
testcase_07 AC 86 ms
36,388 KB
testcase_08 AC 291 ms
66,104 KB
testcase_09 AC 301 ms
66,872 KB
testcase_10 AC 105 ms
43,812 KB
testcase_11 AC 124 ms
50,340 KB
testcase_12 AC 85 ms
36,004 KB
testcase_13 AC 172 ms
61,100 KB
testcase_14 AC 80 ms
33,828 KB
testcase_15 AC 116 ms
48,676 KB
testcase_16 AC 206 ms
61,176 KB
testcase_17 AC 234 ms
65,060 KB
testcase_18 AC 78 ms
33,316 KB
testcase_19 AC 386 ms
72,540 KB
testcase_20 AC 109 ms
45,220 KB
testcase_21 AC 459 ms
77,404 KB
testcase_22 AC 200 ms
61,676 KB
testcase_23 AC 183 ms
61,100 KB
testcase_24 AC 79 ms
33,572 KB
testcase_25 AC 89 ms
37,796 KB
testcase_26 AC 160 ms
61,344 KB
testcase_27 AC 263 ms
65,068 KB
testcase_28 AC 386 ms
72,796 KB
testcase_29 AC 125 ms
52,132 KB
testcase_30 AC 166 ms
61,100 KB
testcase_31 AC 85 ms
35,876 KB
testcase_32 AC 267 ms
65,312 KB
testcase_33 AC 183 ms
61,292 KB
testcase_34 AC 85 ms
36,004 KB
testcase_35 AC 101 ms
42,404 KB
testcase_36 AC 808 ms
94,040 KB
testcase_37 AC 91 ms
185,460 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (100 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.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 c = NList;
        var (n, m, q) = (c[0], c[1], c[2]);
        var map = NArr(q);
        WriteLine(Pair(n, m, q, map));
    }
    static int Pair(int n, int m, int q, int[][] map)
    {
        var ex = new bool[n, m];
        foreach (var pair in map) ex[pair[0] - 1, pair[1] - 1] = true;
        var dp = new int[m];
        for (var i = 0; i < n; ++i)
        {
            var ndp = (int[]) dp.Clone();
            for (var j = 0; j < m; ++j) if (ex[i, j])
            {
                if (j == 0) ndp[j] = 1;
                else ndp[j] = dp[j - 1] + 1;
            }
            for (var j = 1; j < m; ++j) ndp[j] = Math.Max(ndp[j - 1], ndp[j]);
            dp = ndp;
        }
        return dp[^1];
    }
}
0