Treasure Map
Unrated
English
Language
Contribute a translation- Time limit
- 4000 ms
- Memory limit
- 2048 MB (no extra memory)
- Submissions
- 0
- Correct
- 0
- Solved by
- 0
- AC rate
- —
Statement
Examples
Sample input 1
3 3 5 1 1 1 3 1 3 3 2 2 3 3 2 2 4 2 1 5
Sample output 1
3
Sample input 2
3 5 4 3 4 2 4 1 2 2 2 1 1 4 3 1 5
Sample output 2
1
Sample input 3
3 3 3 3 3 2 3 1 2 1 2 1 2 4
Sample output 3
0
Sample input 4
3 3 4 3 2 2 1 2 2 3 3 1 3 4 1 1 5
Sample output 4
impossible
Sample input 5
3 3 3 2 2 3 2 0 2 2 1 2 3 0
Sample output 5
impossible
Tags
No tags yet