SOLPIN - Pretest SOLPIN
Dữ liệu vào: standard input
Dữ liệu ra: standard output
Giới hạn thời gian: 1.0 giây
Giới hạn bộ nhớ: 256 megabyte
Đăng bởi: CaiWinDao

https://www.facebook.com/photo.php?fbid=737070220012527&set=g.163215593699283&type=1&theater&ifg=1

https://www.facebook.com/photo.php?fbid=737070210012528&set=g.163215593699283&type=1&theater&ifg=1

Ví dụ

Input:

4 5
1 2 5 2 1
4 3 1 2 3
2 3 5 3 1
3 2 1 1 5
5
0 2 1
1 2 2 3 4
0 2 4
1 1 1 1 1
1 3 2 4 5

Output:

15
3
17

Back to Top