結果
問題 | No.2667 Constrained Permutation |
ユーザー |
![]() |
提出日時 | 2024-03-08 22:28:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 126,184 KB |
最終ジャッジ日時 | 2024-03-08 22:28:12 |
合計ジャッジ時間 | 11,765 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,460 KB |
testcase_01 | AC | 37 ms
53,460 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 147 ms
88,056 KB |
testcase_13 | AC | 77 ms
70,776 KB |
testcase_14 | AC | 297 ms
114,144 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 306 ms
114,792 KB |
testcase_19 | AC | 334 ms
114,536 KB |
testcase_20 | AC | 307 ms
115,304 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 190 ms
90,560 KB |
testcase_25 | AC | 260 ms
103,612 KB |
testcase_26 | AC | 307 ms
114,948 KB |
testcase_27 | AC | 330 ms
114,864 KB |
testcase_28 | AC | 248 ms
105,604 KB |
testcase_29 | AC | 230 ms
99,716 KB |
testcase_30 | AC | 254 ms
103,428 KB |
testcase_31 | AC | 182 ms
94,116 KB |
testcase_32 | AC | 89 ms
77,944 KB |
testcase_33 | AC | 367 ms
126,184 KB |
testcase_34 | AC | 191 ms
94,112 KB |
testcase_35 | AC | 235 ms
96,896 KB |
testcase_36 | AC | 238 ms
98,296 KB |
testcase_37 | AC | 276 ms
109,948 KB |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | AC | 187 ms
94,108 KB |
testcase_41 | AC | 289 ms
107,240 KB |
testcase_42 | AC | 190 ms
94,124 KB |
testcase_43 | AC | 245 ms
103,424 KB |
testcase_44 | AC | 146 ms
88,056 KB |
testcase_45 | AC | 66 ms
70,776 KB |
ソースコード
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]-=l h[i][1]-=l 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)