結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:15:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,299 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 240,804 KB
最終ジャッジ日時 2023-09-30 10:37:39
合計ジャッジ時間 30,576 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
95,548 KB
testcase_01 AC 244 ms
91,356 KB
testcase_02 AC 240 ms
91,380 KB
testcase_03 AC 241 ms
91,300 KB
testcase_04 AC 256 ms
93,960 KB
testcase_05 AC 244 ms
91,576 KB
testcase_06 AC 1,248 ms
142,008 KB
testcase_07 AC 298 ms
96,848 KB
testcase_08 AC 1,325 ms
143,812 KB
testcase_09 AC 1,505 ms
151,416 KB
testcase_10 AC 389 ms
101,792 KB
testcase_11 AC 468 ms
105,800 KB
testcase_12 AC 296 ms
95,908 KB
testcase_13 AC 688 ms
114,512 KB
testcase_14 AC 271 ms
95,336 KB
testcase_15 AC 428 ms
103,124 KB
testcase_16 AC 858 ms
123,880 KB
testcase_17 AC 995 ms
128,092 KB
testcase_18 AC 268 ms
95,288 KB
testcase_19 AC 1,941 ms
175,400 KB
testcase_20 AC 418 ms
103,136 KB
testcase_21 TLE -
testcase_22 AC 927 ms
126,096 KB
testcase_23 AC 759 ms
117,452 KB
testcase_24 AC 269 ms
95,092 KB
testcase_25 AC 308 ms
97,400 KB
testcase_26 AC 555 ms
109,312 KB
testcase_27 AC 1,062 ms
132,452 KB
testcase_28 AC 1,871 ms
169,200 KB
testcase_29 AC 500 ms
106,376 KB
testcase_30 AC 628 ms
113,452 KB
testcase_31 AC 279 ms
95,416 KB
testcase_32 AC 1,048 ms
132,164 KB
testcase_33 AC 746 ms
117,028 KB
testcase_34 AC 294 ms
96,392 KB
testcase_35 AC 375 ms
100,460 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