結果

問題 No.2667 Constrained Permutation
ユーザー 👑 timitimi
提出日時 2024-03-08 22:50:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 108,956 KB
最終ジャッジ日時 2024-03-08 22:50:22
合計ジャッジ時間 19,255 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 50 ms
60,992 KB
testcase_03 AC 53 ms
63,360 KB
testcase_04 AC 68 ms
70,924 KB
testcase_05 AC 46 ms
61,048 KB
testcase_06 AC 68 ms
70,924 KB
testcase_07 AC 50 ms
61,060 KB
testcase_08 AC 70 ms
72,984 KB
testcase_09 AC 68 ms
72,984 KB
testcase_10 AC 51 ms
63,096 KB
testcase_11 AC 68 ms
70,924 KB
testcase_12 AC 302 ms
81,508 KB
testcase_13 AC 72 ms
72,984 KB
testcase_14 AC 901 ms
108,956 KB
testcase_15 AC 432 ms
91,752 KB
testcase_16 AC 322 ms
89,264 KB
testcase_17 AC 143 ms
79,204 KB
testcase_18 AC 892 ms
97,312 KB
testcase_19 AC 789 ms
95,740 KB
testcase_20 AC 896 ms
97,316 KB
testcase_21 AC 546 ms
97,096 KB
testcase_22 AC 578 ms
96,392 KB
testcase_23 AC 554 ms
96,720 KB
testcase_24 AC 415 ms
83,896 KB
testcase_25 AC 807 ms
98,748 KB
testcase_26 AC 893 ms
97,700 KB
testcase_27 AC 887 ms
98,356 KB
testcase_28 AC 436 ms
95,984 KB
testcase_29 AC 413 ms
92,408 KB
testcase_30 AC 467 ms
103,600 KB
testcase_31 AC 318 ms
84,524 KB
testcase_32 AC 110 ms
77,540 KB
testcase_33 WA -
testcase_34 AC 293 ms
84,524 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 441 ms
88,580 KB
testcase_39 AC 72 ms
72,984 KB
testcase_40 AC 348 ms
84,524 KB
testcase_41 AC 537 ms
95,728 KB
testcase_42 AC 390 ms
86,188 KB
testcase_43 AC 637 ms
104,876 KB
testcase_44 AC 273 ms
81,380 KB
testcase_45 AC 73 ms
72,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[];c=10**10
for i in range(N):
  l,r=map(int, input().split())
  A.append((l,r))
  
A=sorted(A,key=lambda x: x[1])
A=sorted(A,key=lambda x: x[0])
#print(A)
B=[]
ll=-10**10;rr=10**10
for i in range(N):
  l,r=A[i]
  ll=max(ll,l-i)
  rr=min(rr,r-i)
p,q=ll,rr#
#print(ll,rr)
  
A=sorted(A,key=lambda x: x[0])
A=sorted(A,key=lambda x: x[1])
#print(A)
ll=-10**10;rr=10**10
for i in range(N):
  l,r=A[i]
  ll=max(ll,l-i)
  rr=min(rr,r-i)
r,s=ll,rr
#print(p,q,r,s)
print(max(0,max(q,s)-min(r,p)+1))
  
0