cf/mirror

By Elevator or Stairs?

CF
1249E1700· expert2s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
10 2
7 6 18 6 16 18 1 17 17
6 9 3 10 9 1 10 1 5
Output
0 7 13 18 24 35 36 37 40 45
Sample 2of 2
Input
10 1
3 2 3 1 3 3 1 4 1
1 2 3 4 4 1 2 1 3
Output
0 2 4 7 8 11 13 14 16 17
1249E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…