結果
問題 | No.2667 Constrained Permutation |
ユーザー | ゼット |
提出日時 | 2024-03-08 22:12:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 848,316 KB |
最終ジャッジ日時 | 2024-03-08 22:12:16 |
合計ジャッジ時間 | 11,112 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 44 ms
55,588 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 54 ms
59,692 KB |
testcase_11 | WA | - |
testcase_12 | AC | 141 ms
88,056 KB |
testcase_13 | AC | 64 ms
70,776 KB |
testcase_14 | AC | 290 ms
114,152 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 300 ms
114,792 KB |
testcase_19 | AC | 300 ms
114,528 KB |
testcase_20 | AC | 312 ms
115,304 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 161 ms
90,572 KB |
testcase_25 | AC | 253 ms
103,616 KB |
testcase_26 | AC | 304 ms
114,932 KB |
testcase_27 | AC | 295 ms
114,864 KB |
testcase_28 | AC | 254 ms
105,604 KB |
testcase_29 | AC | 224 ms
99,712 KB |
testcase_30 | AC | 247 ms
103,428 KB |
testcase_31 | AC | 176 ms
94,120 KB |
testcase_32 | AC | 87 ms
77,944 KB |
testcase_33 | AC | 375 ms
126,064 KB |
testcase_34 | AC | 183 ms
94,108 KB |
testcase_35 | AC | 226 ms
96,752 KB |
testcase_36 | AC | 230 ms
98,172 KB |
testcase_37 | AC | 267 ms
109,824 KB |
testcase_38 | MLE | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
ソースコード
N=int(input()) l=0 r=10**10 L=[] R=[] h=[] u=10**10 for i in range(N): a,b=map(int,input().split()) L.append(a-1) R.append(b-1) h.append([a-1,b-1]) u=min(u,a-1) L.sort() R.sort() for i in range(N): l=max(l,L[i]-i) for i in range(N): r=min(r,R[i]-i) if l>r: print(0) exit() ans=r-l+1 if ans>10**2: print(ans) exit() p=0 for i in range(N): h[i][0]-=u h[i][1]-=u p=max(p,h[i][0]) G=[[] for i in range(p+1)] for i in range(N): x,y=h[i][:] G[x].append(y) result=0 from heapq import heappush,heappop for k in range(ans+1): S=[] b=True for x in range(k): for y in G[x]: heappush(S,y) for i in range(N): t=i+k if t<=p: for y in G[t]: heappush(S,y) if len(S)==0: b=False break w=heappop(S) if w<t: b=False break if b==True: result+=1 print(result)