Skip to content

Friend

UnratedFunction
English

Language

Contribute a translation
Time limit
1000 ms
Memory limit
16 MB (no extra memory)
Submissions
0
Correct
0
Solved by
0
AC rate
—

Statement

Friend: original English statement, page 1

Friend: original English statement, page 2

Friend: original English statement, page 3

Examples

Sample input 1
6
13 3 6 20 10 15
0 0 0 1 1 2 2 1 0 0
Sample output 1
35
Sample input 2
2
10 20
0 1
Sample output 2
30
Sample input 3
2
10 20
0 2
Sample output 3
20
Sample input 4
2
10 20
0 0
Sample output 4
20
Sample input 5
3
1 1 1
0 0 0 1
Sample output 5
2
Sample input 6
6
13 3 6 20 10 15
0 0 0 1 1 2 2 1 0 0
Sample output 6
35

Tags

No tags yet

Source

This problem accepts only these languages.

C++20