cf/mirror

Deterministic Heap (Easy Version)

CF
2001E12400· grandmaster3s512 MB⌨ stdin/stdout

Examples

Sample 1of 3multi-test • hover to link
Input
7
1 13 998244353
2 1 998244353
3 2 998244853
3 3 998244353
3 4 100000037
4 2 100000039
4 3 100000037
Output
1
2
12
52
124
32
304
Sample 2of 3multi-test • hover to link
Input
1
500 500 100000007
Output
76297230
Sample 3of 3multi-test • hover to link
Input
6
87 63 100000037
77 77 100000039
100 200 998244353
200 100 998244353
32 59 998244853
1 1 998244353
Output
26831232
94573603
37147649
847564946
727060898
1
2001E1.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…