F. cookiebus 数三角形

    Type: Default 1000ms 256MiB

cookiebus 数三角形

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

陈老师在家没事干,于是开始数三角形。作为一个 dalaodalao ,他决定在 11 秒内数出所有三角形。请你写一个程序帮助他。

Description

给出四个整数 A,B,C,DA,B,C,D ,满足 1ABCD5×1051≤A≤B≤C≤D≤5\times10^5,求三边长分别为 x,y,zx,y,z 并且满足 AxByCzDA≤x≤B≤y≤C≤z≤D 的非退化三角形(三顶点不共线)的个数。

Format

Input

一行四个整数: A,B,C,DA,B,C,D

Output

一行,输出满足条件的三角形个数。

Samples

1 2 3 4
4
1 2 2 5
3

Limitation

1s, 1024KiB for each test case.

  • 对于30%30\%的数据: 1ABCD5001≤A≤B≤C≤D≤500
  • 对于40%40\%的数据: 1ABCD10001≤A≤B≤C≤D≤1000
  • 对于100%100\%的数据: 1ABCD5000001≤A≤B≤C≤D≤500000

20241031周赛

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2024-10-31 16:45
End at
2024-10-31 18:30
Duration
1.8 hour(s)
Host
Partic.
16