cf/mirror

Removal of a Sequence (Hard Version)

CF
2169D22100· master2s512 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
6
2 3 5
2 5 1
20 2 1000000000000
175 10 28
1000000000 998244353 1999999999
1 1 1
Output
10
1
-1
2339030304
4672518823
-1
2169D2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)