結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:21:47
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,323 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,404 KB
実行使用メモリ 191,644 KB
最終ジャッジ日時 2023-09-30 10:47:47
合計ジャッジ時間 32,190 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 266 ms
92,604 KB
testcase_01 AC 262 ms
92,760 KB
testcase_02 AC 270 ms
92,832 KB
testcase_03 AC 265 ms
92,880 KB
testcase_04 AC 278 ms
95,100 KB
testcase_05 AC 268 ms
93,240 KB
testcase_06 AC 1,275 ms
143,856 KB
testcase_07 AC 325 ms
98,556 KB
testcase_08 AC 1,352 ms
145,468 KB
testcase_09 AC 1,628 ms
152,868 KB
testcase_10 AC 414 ms
103,004 KB
testcase_11 AC 491 ms
107,108 KB
testcase_12 AC 322 ms
97,776 KB
testcase_13 AC 713 ms
116,188 KB
testcase_14 AC 305 ms
96,648 KB
testcase_15 AC 459 ms
104,948 KB
testcase_16 AC 893 ms
125,336 KB
testcase_17 AC 1,012 ms
129,616 KB
testcase_18 AC 291 ms
96,496 KB
testcase_19 AC 1,997 ms
177,044 KB
testcase_20 AC 455 ms
104,820 KB
testcase_21 TLE -
testcase_22 AC 970 ms
127,312 KB
testcase_23 AC 779 ms
118,528 KB
testcase_24 AC 289 ms
96,764 KB
testcase_25 AC 328 ms
98,984 KB
testcase_26 AC 591 ms
110,996 KB
testcase_27 AC 1,088 ms
133,716 KB
testcase_28 AC 1,908 ms
171,480 KB
testcase_29 AC 512 ms
108,172 KB
testcase_30 AC 653 ms
114,408 KB
testcase_31 AC 309 ms
97,168 KB
testcase_32 AC 1,084 ms
133,696 KB
testcase_33 AC 775 ms
118,796 KB
testcase_34 AC 313 ms
97,636 KB
testcase_35 AC 395 ms
102,032 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]
inf=1<<60
ans=len(LIS(B,max_value=inf))
print(ans)
0