#P7890. 「MCOI-06」Lost Desire
「MCOI-06」Lost Desire
Background
頰滴る 紅い涙
不安定な視界の中
差し出した手を取れたら
あぁ…そんな世界を夢みた
哭いて…
激しく 燃やした 黒い感情
届かぬ この手に
Cry 闇の中で
最果てから 光へ手を翳して
揺らいだ想いさえも 闇の奥底へ堕ちてく
Netease Cloud Music trial listening link for this song
Problem Description
Let positive integers be coprime, and let be an integer. Define the function as follows: among the set of positive integers less than , , consider all -element subsets that satisfy . Then is the number of such subsets .
Now given positive integers , compute the product of all such that , , , and and are coprime.
Since the result is very large, you only need to output the value modulo a given prime .
Also, please pay attention to the impact of constant factors when implementing your program.
Input Format
This problem has multiple test cases. Each test point contains a total of test cases.
The first line contains two positive integers .
The next lines each contain three positive integers , separated by spaces.
Output Format
For each test case, output one line with one integer, representing the required value (modulo ).
3 1926195307
2 3 3
3 3 3
5 6 1
8
64
363031200
Hint
This problem uses bundled tests, divided into subtasks.
- For Subtask 1
(Tutorial):- .
- .
- .
- For Subtask 2
(PST 4.0):- .
- .
- .
- For Subtask 3
(PRS 7.5):- .
- .
- .
- For Subtask 4
(FTR 9.8):- .
- .
- .
- For Subtask 5
(BYD 11.0):- .
- .
- .
The scores for Subtasks are , respectively.
In particular, suppose that in one test point the first queries are correct; then you get $\left\lfloor100\times\sqrt\dfrac{x}{T}\right\rfloor\%$ of the score of that test point. Your score for any Subtask is the minimum score among all test points in that Subtask.
In particular, any TLE gets points. (There is no need to fill in the answers for test points that are not solved within the time limit; doing so may cause strange errors.)
Reminder again: please pay attention to the impact of constant factors when implementing your program.
Idea: Powerless Std&Data: w33z (Data was corrected on 2021.10.05).
Subtask 4 was added by Prean, and Subtask 5 by w33z.
This problem was added on 2021.10.01. Thanks for their help.
2021.10.01 - 2021.12.07: 68 days, 1st kill (Leasier).
2021.10.01 - 2022.01.21: 113 days, 2nd kill (wkywkywkywky).
2021.10.01 - 2022.02.26: 149 days, 3rd kill (NaNH2).
Translated by ChatGPT 5