結果

問題 No.1703 Much Matching
ユーザー 👑 rin204rin204
提出日時 2022-01-23 01:10:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 977 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 1,658 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 198,436 KB
最終ジャッジ日時 2023-08-18 23:30:13
合計ジャッジ時間 11,904 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,248 KB
testcase_01 AC 76 ms
71,260 KB
testcase_02 AC 74 ms
71,448 KB
testcase_03 AC 74 ms
71,416 KB
testcase_04 AC 83 ms
75,168 KB
testcase_05 AC 78 ms
71,264 KB
testcase_06 AC 328 ms
105,684 KB
testcase_07 AC 120 ms
77,668 KB
testcase_08 AC 336 ms
108,788 KB
testcase_09 AC 374 ms
113,880 KB
testcase_10 AC 143 ms
80,176 KB
testcase_11 AC 159 ms
82,272 KB
testcase_12 AC 118 ms
78,016 KB
testcase_13 AC 208 ms
88,660 KB
testcase_14 AC 107 ms
77,808 KB
testcase_15 AC 155 ms
81,264 KB
testcase_16 AC 237 ms
92,340 KB
testcase_17 AC 273 ms
97,680 KB
testcase_18 AC 109 ms
77,696 KB
testcase_19 AC 471 ms
128,672 KB
testcase_20 AC 148 ms
80,832 KB
testcase_21 AC 551 ms
141,436 KB
testcase_22 AC 257 ms
96,456 KB
testcase_23 AC 228 ms
90,492 KB
testcase_24 AC 103 ms
77,520 KB
testcase_25 AC 120 ms
78,068 KB
testcase_26 AC 179 ms
84,796 KB
testcase_27 AC 292 ms
100,800 KB
testcase_28 AC 458 ms
127,576 KB
testcase_29 AC 166 ms
82,496 KB
testcase_30 AC 197 ms
86,272 KB
testcase_31 AC 117 ms
77,668 KB
testcase_32 AC 280 ms
100,456 KB
testcase_33 AC 221 ms
90,436 KB
testcase_34 AC 115 ms
77,596 KB
testcase_35 AC 136 ms
79,868 KB
testcase_36 AC 977 ms
198,436 KB
testcase_37 AC 90 ms
75,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left

n, m, q = map(int, input().split())
lst = [[] for _ in range(n)]
for _ in range(q):
    x, y = map(int, input().split())
    lst[x - 1].append(y)
Y = []
for ls in lst:
    ls.sort(reverse = True)
    Y += ls

lst = []
for y in Y:
    p = bisect_left(lst, y)
    if p == len(lst):
        lst.append(y)
    else:
        lst[p] = y

print(len(lst))
0