Submission #1475425


Source Code Expand

N = int(input())

T = list(map(int, input().split()))
A = list(map(int, input().split()))


def judge(t):
    if t[0] == t[1]:
        return True
    else:
        return False

if judge(A[0:2]) and A[0] < T[0]:
    ans = 0
    ansable = False
elif not judge(A[0:2]) and A[0] != T[0]:
    ans = 0
    ansable = False
else:
    ans = 1
    ansable = True
    

for i in range(1, N-1):
    if ansable == False:
        break
    
    elif not judge(A[i:i+2]) and not judge(T[i-1:i+1]):
        if A[i] != T[i]:
            ans = 0   
            ansable = False
    elif not judge(A[i:i+2]) and judge(T[i-1:i+1]):
        if A[i] > T[i]:
            ans = 0
            ansable = False
    elif judge(A[i:i+2]) and not judge(T[i-1:i+1]):
        if A[i] < T[i]:
            ans = 0  
            ansable = False
    elif judge(A[i:i+2]) and judge(T[i-1:i+1]):
         ans *= (min(A[i],T[i]))%(10**9+7)
            
print(ans%(10**9+7))

Submission Info

Submission Time
Task C - Two Alpinists
User TakuyaNakazato02
Language Python (3.4.3)
Score 0
Code Size 977 Byte
Status RE
Exec Time 2104 ms
Memory 18752 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
RE × 1
AC × 14
TLE × 5
RE × 2
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt
Case Name Status Exec Time Memory
0_000.txt AC 17 ms 3064 KB
0_001.txt AC 17 ms 3064 KB
0_002.txt AC 17 ms 3064 KB
0_003.txt RE 17 ms 3064 KB
1_004.txt RE 17 ms 3064 KB
1_005.txt AC 17 ms 3064 KB
1_006.txt AC 16 ms 3064 KB
1_007.txt AC 17 ms 3064 KB
1_008.txt TLE 2104 ms 18752 KB
1_009.txt AC 202 ms 18532 KB
1_010.txt AC 1050 ms 18076 KB
1_011.txt TLE 2104 ms 18156 KB
1_012.txt AC 135 ms 18240 KB
1_013.txt TLE 2104 ms 18244 KB
1_014.txt AC 186 ms 18476 KB
1_015.txt TLE 2104 ms 18404 KB
1_016.txt AC 442 ms 18240 KB
1_017.txt TLE 2104 ms 16808 KB
1_018.txt AC 676 ms 16964 KB
1_019.txt AC 1155 ms 15252 KB
1_020.txt AC 576 ms 13408 KB