結果

問題 No.1703 Much Matching
ユーザー harurunharurun
提出日時 2021-09-03 14:38:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 97,180 KB
最終ジャッジ日時 2023-09-30 09:25:55
合計ジャッジ時間 7,612 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,980 KB
testcase_01 AC 77 ms
70,820 KB
testcase_02 AC 76 ms
70,892 KB
testcase_03 AC 86 ms
75,636 KB
testcase_04 AC 86 ms
75,868 KB
testcase_05 AC 91 ms
75,864 KB
testcase_06 AC 179 ms
81,752 KB
testcase_07 AC 92 ms
75,972 KB
testcase_08 AC 209 ms
89,668 KB
testcase_09 AC 206 ms
83,420 KB
testcase_10 AC 106 ms
77,692 KB
testcase_11 AC 125 ms
83,064 KB
testcase_12 AC 91 ms
75,988 KB
testcase_13 AC 141 ms
82,280 KB
testcase_14 AC 87 ms
75,800 KB
testcase_15 AC 127 ms
86,504 KB
testcase_16 AC 142 ms
79,528 KB
testcase_17 AC 160 ms
80,604 KB
testcase_18 AC 84 ms
75,900 KB
testcase_19 AC 225 ms
83,848 KB
testcase_20 AC 100 ms
77,340 KB
testcase_21 AC 262 ms
86,720 KB
testcase_22 AC 167 ms
83,092 KB
testcase_23 AC 145 ms
80,316 KB
testcase_24 AC 89 ms
75,820 KB
testcase_25 AC 103 ms
79,624 KB
testcase_26 AC 138 ms
81,916 KB
testcase_27 AC 164 ms
80,516 KB
testcase_28 AC 252 ms
86,720 KB
testcase_29 AC 130 ms
81,568 KB
testcase_30 AC 141 ms
80,744 KB
testcase_31 AC 98 ms
76,052 KB
testcase_32 AC 179 ms
82,660 KB
testcase_33 AC 157 ms
83,136 KB
testcase_34 AC 95 ms
75,968 KB
testcase_35 AC 109 ms
77,904 KB
testcase_36 AC 425 ms
97,180 KB
testcase_37 AC 118 ms
90,744 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