cf/mirror

Amanojaku and Sequence (Easy Version)

CF
2228E12400· grandmaster4s512 MB⌨ stdin/stdout

Examples

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