General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
162654224 Practice:
shiviDON
4D - 12 PyPy 3-64 Time limit exceeded on test 33 1000 ms 9332 KB 2022-07-03 17:39:01 2022-07-03 17:39:01
 
 
→ Source
#If you win, you live. You cannot win unless you fight.
# remember hash hack use tuple
import string
from sys import  stdin,setrecursionlimit
input=stdin.readline
rd=lambda: map(lambda s: int(s), input().strip().split())
rdG=lambda: map(lambda s: int(s)-1, input().strip().split())
ri=lambda: int(input())
rs=lambda :input().strip()
from collections import defaultdict,deque,Counter
from bisect import bisect_left as bl, bisect_right as br
from math import gcd, ceil, floor,log2,factorial
from  copy import  deepcopy

n,H,W=rd()
dp=[[-float("inf"),None] for i in range(n)]
q=[]
for _ in range(n):
    h,w=rd()
    q.append((h,w,_))
q.sort()
for i in range(n):
    if q[i][0]>H and q[i][1]>W:
        dp[i]=[1,None]
for i in range(n):
    if q[i][0]>H and q[i][1]>W:
        for j in range(i+1,n):
            if q[i][0]<q[j][0] and q[i][1]<q[j][1] :
                if dp[j][0]<dp[i][0]+1:
                    dp[j]=[dp[i][0]+1,i]

mx=max(dp,key=lambda s:s[0])
if mx[0]==-float("inf"):
    print(0)
    exit()
ans=dp.index(mx)
ap=[]
while ans!=None:
    ap.append(q[ans][-1]+1)
    ans=dp[ans][-1]
ap=ap[::-1]
print(len(ap))
print(*ap)
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details