結果

問題 No.1703 Much Matching
ユーザー harurunharurun
提出日時 2021-09-03 14:38:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,123 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 41,216 KB
最終ジャッジ日時 2023-09-30 09:25:46
合計ジャッジ時間 11,189 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 18 ms
7,804 KB
testcase_03 AC 110 ms
12,544 KB
testcase_04 AC 79 ms
11,084 KB
testcase_05 AC 210 ms
16,920 KB
testcase_06 AC 349 ms
16,380 KB
testcase_07 AC 37 ms
9,016 KB
testcase_08 AC 495 ms
23,940 KB
testcase_09 AC 453 ms
20,944 KB
testcase_10 AC 96 ms
10,576 KB
testcase_11 AC 198 ms
14,380 KB
testcase_12 AC 49 ms
9,444 KB
testcase_13 AC 206 ms
13,436 KB
testcase_14 AC 25 ms
8,300 KB
testcase_15 AC 271 ms
17,816 KB
testcase_16 AC 210 ms
12,312 KB
testcase_17 AC 245 ms
12,908 KB
testcase_18 AC 19 ms
8,292 KB
testcase_19 AC 500 ms
20,864 KB
testcase_20 AC 67 ms
9,048 KB
testcase_21 AC 606 ms
24,340 KB
testcase_22 AC 396 ms
20,652 KB
testcase_23 AC 237 ms
14,404 KB
testcase_24 AC 26 ms
8,544 KB
testcase_25 AC 85 ms
10,964 KB
testcase_26 AC 307 ms
18,648 KB
testcase_27 AC 262 ms
13,048 KB
testcase_28 AC 635 ms
28,208 KB
testcase_29 AC 223 ms
15,404 KB
testcase_30 AC 240 ms
15,380 KB
testcase_31 AC 81 ms
11,200 KB
testcase_32 AC 368 ms
18,752 KB
testcase_33 AC 368 ms
20,344 KB
testcase_34 AC 40 ms
9,060 KB
testcase_35 AC 98 ms
10,872 KB
testcase_36 AC 1,123 ms
41,216 KB
testcase_37 AC 380 ms
24,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
pin=stdin.readline

def lcs(N,M,check):
  dp=[[0]*(M+1)for _ in[0]*(N+1)]
  for i in range(1,N+1):
    for j in range(1,M+1):
      if check[i-1][j-1]==1:
        dp[i][j]=dp[i-1][j-1]+1
      else:
        dp[i][j]=max(dp[i-1][j],dp[i][j-1])
  return dp[N][M]

def main():
  N,M,Q=map(int,pin().split())
  check=[[0]*M for _ in[0]*N]
  for _ in[0]*Q:
    a,b=map(int,pin().split())
    check[a-1][b-1]=1
  print(lcs(N,M,check))
  return

main()
0