def main():
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [-1] + A + [-1]
B = [-1] + B + [-1]
A_peaks = 0
for i in range(N):
if A[i-1] < A[i] > A[i+1]:
A_peaks+=1
B_peaks= 0
for i in range(M):
if B[i-1] < B[i] > B[i+1]:
B_peaks+=1
print(A_peaks * B_peaks)
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 16ms | 3132 KiB | ||||
2 | Wrong answer | 16ms | 3128 KiB | ||||
subtask2 | 0/16 | ||||||
3 | Wrong answer | 57ms | 14596 KiB | ||||
4 | Wrong answer | 59ms | 13056 KiB | ||||
5 | Wrong answer | 46ms | 5892 KiB | ||||
6 | Wrong answer | 61ms | 14508 KiB | ||||
7 | Accepted | 52ms | 15184 KiB | ||||
8 | Wrong answer | 57ms | 14156 KiB | ||||
subtask3 | 0/33 | ||||||
9 | Wrong answer | 17ms | 3252 KiB | ||||
10 | Accepted | 17ms | 3144 KiB | ||||
11 | Wrong answer | 17ms | 3064 KiB | ||||
12 | Wrong answer | 16ms | 3356 KiB | ||||
13 | Wrong answer | 16ms | 3128 KiB | ||||
14 | Wrong answer | 16ms | 3224 KiB | ||||
15 | Wrong answer | 17ms | 3336 KiB | ||||
subtask4 | 0/51 | ||||||
16 | Wrong answer | 94ms | 18128 KiB | ||||
17 | Wrong answer | 67ms | 15156 KiB | ||||
18 | Accepted | 97ms | 17804 KiB | ||||
19 | Wrong answer | 57ms | 14612 KiB | ||||
20 | Wrong answer | 61ms | 14564 KiB | ||||
21 | Accepted | 94ms | 18208 KiB | ||||
22 | Wrong answer | 101ms | 17864 KiB | ||||
23 | Accepted | 79ms | 16724 KiB | ||||
24 | Wrong answer | 101ms | 17804 KiB |