結果

問題 No.1703 Much Matching
ユーザー tamatotamato
提出日時 2021-10-08 22:17:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 572 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 1,129 ms
コンパイル使用メモリ 86,516 KB
実行使用メモリ 85,264 KB
最終ジャッジ日時 2023-09-30 10:40:06
合計ジャッジ時間 8,563 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,096 KB
testcase_01 AC 75 ms
71,220 KB
testcase_02 AC 76 ms
71,272 KB
testcase_03 AC 81 ms
75,768 KB
testcase_04 AC 85 ms
76,200 KB
testcase_05 AC 83 ms
75,740 KB
testcase_06 AC 217 ms
80,548 KB
testcase_07 AC 105 ms
77,540 KB
testcase_08 AC 249 ms
82,808 KB
testcase_09 AC 268 ms
81,728 KB
testcase_10 AC 113 ms
78,136 KB
testcase_11 AC 131 ms
80,280 KB
testcase_12 AC 99 ms
77,780 KB
testcase_13 AC 158 ms
79,412 KB
testcase_14 AC 90 ms
76,216 KB
testcase_15 AC 131 ms
82,328 KB
testcase_16 AC 169 ms
79,036 KB
testcase_17 AC 192 ms
79,548 KB
testcase_18 AC 92 ms
76,212 KB
testcase_19 AC 296 ms
80,908 KB
testcase_20 AC 113 ms
77,628 KB
testcase_21 AC 344 ms
81,868 KB
testcase_22 AC 207 ms
81,804 KB
testcase_23 AC 171 ms
79,808 KB
testcase_24 AC 89 ms
76,332 KB
testcase_25 AC 107 ms
78,836 KB
testcase_26 AC 157 ms
82,320 KB
testcase_27 AC 199 ms
79,472 KB
testcase_28 AC 326 ms
84,124 KB
testcase_29 AC 136 ms
81,076 KB
testcase_30 AC 157 ms
80,428 KB
testcase_31 AC 101 ms
78,436 KB
testcase_32 AC 214 ms
80,800 KB
testcase_33 AC 183 ms
82,488 KB
testcase_34 AC 107 ms
77,424 KB
testcase_35 AC 122 ms
78,496 KB
testcase_36 AC 572 ms
85,264 KB
testcase_37 AC 91 ms
75,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.readline

    N, M, Q = map(int, input().split())
    XY = [[0] * (M+1) for _ in range(N+1)]
    for _ in range(Q):
        x, y = map(int, input().split())
        XY[x][y] = 1

    LIS = [0]
    for x in range(1, N+1):
        for y in range(M, 0, -1):
            if XY[x][y] == 0:
                continue
            j = bisect_left(LIS, y)
            if j == len(LIS):
                LIS.append(y)
            else:
                LIS[j] = y
    print(len(LIS) - 1)


if __name__ == '__main__':
    main()
0