ログインしてください。
提出 #76634010
ソースコード 拡げる
n,d=map(int,input().split())
E=[0 for i in range(10**6+10)]
for i in range(n):
s,t=map(int,input().split())
if t-s<d:continue
E[s]+=1
E[t-d+1]-=1
ans=0
can=0
for i,num in enumerate(E):
can += num
ans += can*(can-1)//2
print(ans)
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Accomplice |
| ユーザ | nikuroll |
| 言語 | Python (PyPy 3.11-v7.3.20) |
| 得点 | 400 |
| コード長 | 276 Byte |
| 結果 | AC |
| 実行時間 | 269 ms |
| メモリ | 116160 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| All | 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, sample-01.txt, sample-02.txt, sample-03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 04.txt | AC | 55 ms | 92684 KiB |
| 05.txt | AC | 56 ms | 93104 KiB |
| 06.txt | AC | 226 ms | 116052 KiB |
| 07.txt | AC | 221 ms | 116120 KiB |
| 08.txt | AC | 226 ms | 115772 KiB |
| 09.txt | AC | 226 ms | 116076 KiB |
| 10.txt | AC | 223 ms | 115876 KiB |
| 11.txt | AC | 59 ms | 95320 KiB |
| 12.txt | AC | 62 ms | 97204 KiB |
| 13.txt | AC | 73 ms | 108944 KiB |
| 14.txt | AC | 132 ms | 115980 KiB |
| 15.txt | AC | 198 ms | 115768 KiB |
| 16.txt | AC | 240 ms | 115996 KiB |
| 17.txt | AC | 263 ms | 115964 KiB |
| 18.txt | AC | 264 ms | 116160 KiB |
| 19.txt | AC | 230 ms | 116116 KiB |
| 20.txt | AC | 262 ms | 116064 KiB |
| 21.txt | AC | 267 ms | 115864 KiB |
| 22.txt | AC | 258 ms | 116004 KiB |
| 23.txt | AC | 269 ms | 115992 KiB |
| sample-01.txt | AC | 56 ms | 92992 KiB |
| sample-02.txt | AC | 56 ms | 93036 KiB |
| sample-03.txt | AC | 56 ms | 93320 KiB |