P5819 [L&K R-03] Rhythm Game Big Calculation.
Description
Xiao K likes playing rhythm games, especially one called dimou. The judgment system of dimou works like this: dimou is a single-sided falling rhythm game (unlike something starting with “dy”). Specifically, there is a judgment line at the bottom of the screen. A song has several hit objects (called keys; you can think of each as a line segment parallel to the judgment line, with only left-right width). Each key falls from the top at a constant speed at some time, and the player needs to click it as accurately as possible when it overlaps the judgment line.
Of course, the player may click before a key touches the judgment line, or click only after the key has already fallen below the judgment line. In that case, we need to consider the game’s judgment system to count how the player finishes the song. dimou has three judgments: perfect, good, and miss. There are six cases in total.
Case $1$: If the click time is $1s$ or more before the time when some key falls to overlap the judgment line (denote this as $\triangle t\ge1$, same below), then no judgment effect is produced (equivalent to a meaningless click).
Case $2$: If $0.6\le\triangle t
Input Format
The first line contains two positive integers $n,m$, representing the number of keys and the number of clicks by Xiao K.
Then follow $n$ lines, each containing three floating-point numbers (with at most $5$ digits after the decimal point) $t_i,a_i,b_i$, representing, for each key, the time from the start of the song to when it reaches the judgment line, its left endpoint position, and its right endpoint position.
Then follow $m$ lines, each containing two floating-point numbers (with at most $5$ digits after the decimal point) $T_i,x_i$, representing the time from the start of the song for each click and its position.
Output Format
Output one line with four non-negative integers, separated pairwise by a single space, representing the number of perfect, the number of good, the number of miss, and the max combo.
Explanation/Hint
Sample $3$: [input](https://www.luogu.com.cn/paste/qrbt8fnq), [output](https://www.luogu.com.cn/paste/evke45h8).
Sample $4$: [input](https://www.luogu.com.cn/paste/a71namso), [output](https://www.luogu.com.cn/paste/jgpcani2).
[Sample Explanation]
For sample $1$: The judgments produced by the $5$ keys, in time order, are miss, good, perfect, good, miss. The first and the last click do not produce any judgment effect.
For sample $2$: In time order, for the first click ($T=0.0$), the keys that may produce a judgment effect are keys $1,2,4$ (in input order). Keys $1,2$ reach the judgment line at the same time, and key $4$ is higher than keys $1,2$. Therefore, the first click only makes keys $1,2$ produce perfect judgments. For the second click ($T=0.6$), the keys intersecting its perpendicular line are keys $3,4$, but key $3$ has already produced a miss judgment and disappeared, so this click makes key $4$ produce one perfect judgment. At this time, there are two judgments at the same time: perfect and miss. According to the rule, process miss before perfect. Therefore, all judgments in time order are perfect, perfect, miss, perfect. It is easy to see that the miss splits the judgment sequence into two segments: the first segment has a combo of $2$, the second segment has a combo of $1$, so max combo is $2$.
[Constraints]
For $30\%$ of the data, $n,m\le5000$.
For another $20\%$ of the data, $n\le5000$, $m\le114514$.
For another $10\%$ of the data, all $a_i$ are equal, and all $b_i$ are equal.
For another $10\%$ of the data, $t_i,T_i,a_i,b_i,x_i$ are randomly generated in $[0,10^4]$.
For $100\%$ of the data, $1\le n,m\le114514$, $0\le t_i,T_i,a_i,b_i,x_i\le 10^4$, and $a_i\le b_i$.
Translated by ChatGPT 5