結果
| 問題 | No.817 Coin donation |
| コンテスト | |
| ユーザー |
tomarint2
|
| 提出日時 | 2019-04-19 22:24:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 460 ms / 2,000 ms |
| コード長 | 547 bytes |
| 記録 | |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 84,896 KB |
| 実行使用メモリ | 132,184 KB |
| 最終ジャッジ日時 | 2026-04-11 03:50:18 |
| 合計ジャッジ時間 | 3,231 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 |
ソースコード
import collections
def solve():
N,K=map(int,input().split())
dn=collections.defaultdict(int)
for i in range(N):
a,b=map(int,input().split())
dn[a]+=1
dn[b+1]-=1
d1=list(dn.items())
d1.sort()
#print(d1)
d2=[]
b=1
d=0
for di in d1:
d2.append((b,di[0],d))
b=di[0]
d+=di[1]
#print(d2)
for di in d2:
if K > (di[1]-di[0])*di[2]:
K -= (di[1]-di[0])*di[2]
else:
return (K+di[2]-1) // di[2] + di[0] - 1
print(solve())
tomarint2