結果

問題 No.2462 七人カノン
ユーザー 👑 timitimi
提出日時 2023-09-18 05:01:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 142,932 KB
最終ジャッジ日時 2023-09-18 05:02:08
合計ジャッジ時間 11,765 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,380 KB
testcase_01 AC 72 ms
71,532 KB
testcase_02 AC 72 ms
71,576 KB
testcase_03 AC 96 ms
76,488 KB
testcase_04 AC 93 ms
76,484 KB
testcase_05 AC 93 ms
76,640 KB
testcase_06 AC 94 ms
76,668 KB
testcase_07 AC 92 ms
76,456 KB
testcase_08 AC 91 ms
76,512 KB
testcase_09 AC 85 ms
75,420 KB
testcase_10 AC 96 ms
76,632 KB
testcase_11 AC 96 ms
76,572 KB
testcase_12 AC 94 ms
76,648 KB
testcase_13 AC 354 ms
134,260 KB
testcase_14 AC 347 ms
134,800 KB
testcase_15 AC 358 ms
119,452 KB
testcase_16 AC 365 ms
137,676 KB
testcase_17 AC 381 ms
137,468 KB
testcase_18 AC 100 ms
78,320 KB
testcase_19 AC 100 ms
78,736 KB
testcase_20 AC 323 ms
97,132 KB
testcase_21 AC 313 ms
97,340 KB
testcase_22 AC 313 ms
97,232 KB
testcase_23 AC 314 ms
97,208 KB
testcase_24 AC 294 ms
127,576 KB
testcase_25 AC 390 ms
142,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int, input().split())
A=[];T=[]
for _ in range(Q):
  i,s,t=map(int, input().split())
  T.append(s)
  T.append(t)
  A.append((i,s,t))
  
T=sorted(list(set(T)))
D={}
for i in range(len(T)):
  D[T[i]]=i

B=[0]*(len(T)+1)
for i,s,t in A:
  s,t=D[s],D[t] 
  B[s]+=1;B[t]-=1

c=0;C=[]
for b in B:
  c+=b 
  C.append(c)

e=0;E=[0]
for i in range(len(T)-1):
  t=T[i+1]-T[i]
  if C[i]!=0:
    e+=t/C[i]
  E.append(e)

ans=[0]*N
for i,s,t in A:
  ans[i-1]+=E[D[t]]-E[D[s]]
for i in ans:
  print(i)
0