cf/mirror

Amanojaku and Sequence (Hard Version)

CF
2228E22500· grandmaster4s512 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
2
5 7
4 -1 7 6 -1
2 2 2 2
1 3 8
2 3 3 0
2 4 5 8
1 5 7
2 3 5 21
2 3 5 22
4 6
-1 -1 -1 -1
2 1 1 4
2 1 2 5
2 1 3 6
2 1 4 7
1 3 3
2 1 4 5
Output
4
0
100
701
0
16
205
1736
12180
286
2228E2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)