結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:15:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,299 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 238,676 KB
最終ジャッジ日時 2024-07-23 04:44:21
合計ジャッジ時間 27,488 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
95,616 KB
testcase_01 AC 145 ms
89,600 KB
testcase_02 AC 144 ms
89,728 KB
testcase_03 AC 145 ms
89,728 KB
testcase_04 AC 146 ms
89,728 KB
testcase_05 AC 145 ms
89,788 KB
testcase_06 AC 1,260 ms
137,808 KB
testcase_07 AC 199 ms
92,692 KB
testcase_08 AC 1,315 ms
138,712 KB
testcase_09 AC 1,498 ms
145,368 KB
testcase_10 AC 292 ms
97,776 KB
testcase_11 AC 383 ms
100,940 KB
testcase_12 AC 188 ms
91,904 KB
testcase_13 AC 621 ms
110,880 KB
testcase_14 AC 163 ms
90,624 KB
testcase_15 AC 333 ms
98,604 KB
testcase_16 AC 822 ms
118,992 KB
testcase_17 AC 924 ms
123,524 KB
testcase_18 AC 162 ms
90,880 KB
testcase_19 AC 1,961 ms
170,488 KB
testcase_20 AC 314 ms
98,492 KB
testcase_21 TLE -
testcase_22 AC 877 ms
121,540 KB
testcase_23 AC 694 ms
114,612 KB
testcase_24 AC 163 ms
91,072 KB
testcase_25 AC 205 ms
92,800 KB
testcase_26 AC 481 ms
105,740 KB
testcase_27 AC 1,033 ms
127,952 KB
testcase_28 AC 1,888 ms
165,020 KB
testcase_29 AC 404 ms
101,828 KB
testcase_30 AC 558 ms
108,620 KB
testcase_31 AC 177 ms
91,912 KB
testcase_32 AC 995 ms
127,384 KB
testcase_33 AC 667 ms
113,320 KB
testcase_34 AC 200 ms
92,288 KB
testcase_35 AC 276 ms
96,412 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import random
import sys
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

def LIS(lst,weakly=False,max_value=float('inf')):
    f=bisect.bisect_right if weakly else bisect.bisect_left
    N=len(lst)
    update=[None]*N
    dp=[max_value]*N
    for k,x in enumerate(lst):
        i=f(dp,x)
        dp[i]=x
        update[k]=(i,dp[i])
    n=bisect.bisect_left(dp,max_value)
    lis=[None]*n
    n-=1
    for i,x in update[::-1]:
        if i==n:
            lis[n]=x
            n-=1
    return lis

N,M,Q=map(int,readline().split())
AB=[]
for _ in range(Q):
    a,b=map(int,readline().split())
    AB.append((a,b))
AB.sort(key=lambda tpl:(tpl[0],-tpl[1]))
B=[b for a,b in AB]
ans=len(LIS(B))
print(ans)
0