ユニークビジョンプログラミングコンテスト2024 秋(AtCoder Beginner Contest 372)
翻译中…
Problem Statement
翻译中…
You are given three length-$N$ sequences of positive integers: $A=(A_1,A_2,\ldots,A_N)$, $B=(B_1,B_2,\ldots,B_N)$, and $C=(C_1,C_2,\ldots,C_N)$.
翻译中…
Find the number of pairs of positive integers $(x, y)$ that satisfy the following condition:
翻译中…
$A_i \times x + B_i \times y < C_i$for all$1 \leq i \leq N$.
翻译中…
It can be proved that the number of such pairs of positive integers satisfying the condition is finite.
翻译中…
You are given $T$ test cases, each of which should be solved.
翻译中…
Constraints
翻译中…
$1 \leq T \leq 2 \times 10^5$$1 \leq N \leq 2 \times 10^5$$1 \leq A_i, B_i, C_i \leq 10^9$- The sum of
$N$over all test cases is at most$2 \times 10^5$. - All input values are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format. Here, $\mathrm{case}_i$ refers to the $i$-th test case.
翻译中…
T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T
翻译中…
Each test case is given in the following format:
翻译中…
N
A_1 B_1 C_1
A_2 B_2 C_2
\vdots
A_N B_N C_N
翻译中…
Output
翻译中…
Print $T$ lines. The $i$-th line $(1 \leq i \leq T)$ should contain the answer for $\mathrm{case}_i$.
翻译中…
样例
Input #1
2
2
1 1 4
1 2 5
1
1 1 2
Output #1
2
0
In the first test case, there are two valid pairs of integers: $(x, y) = (1, 1), (2,1)$. Thus, the first line should contain $2$.
In the second test case, there are no valid pairs of integers. Thus, the second line should contain $0$.
Input #2
3
7
138 16011 918976
5478 7748 499926
5234 17727 748589
1157 10511 643136
31200 3005 721285
28839 14469 798851
1933 5378 864127
9
17775 1665 386430
37001 863 922418
9756 4182 746671
12379 9106 807578
3984 4049 640539
25333 9869 780810
20372 7000 688738
16107 11974 827227
10779 10531 770510
5
4916 14132 460944
11856 45422 610561
56014 18216 825793
10363 6220 945356
37418 33866 851593
Output #2
660
995
140
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。