Submission #1475376
Source Code Expand
N = int(input()) T = list(map(int, input().split())) A = list(map(int, input().split())) Th = [[T[0]]] th_prev = T[0] for i in range(1, N): if T[i] == th_prev: Th.append([1, th_prev]) else: Th.append([T[i]]) th_prev = T[i] A = A[::-1] Ah = [[A[0]]] ah_prev = A[0] for i in range(1, N): if A[i] == ah_prev: Ah.append([1, ah_prev]) else: Ah.append([A[i]]) ah_prev = A[i] Ah = Ah[::-1] ans = 1 for i in range(N): if len(Ah[i]) == 1 and len(Th[i]) == 1: if Ah[i][0] != Th[i][0]: ans = 0 elif len(Ah[i]) == 1 and len(Th[i]) == 2: if Ah[i][0] > Th[i][1]: ans = 0 elif len(Ah[i]) == 2 and len(Th[i]) == 1: if Ah[i][1] < Th[i][0]: ans = 0 elif len(Ah[i]) == 2 and len(Th[i]) == 2: ans *= (abs(Ah[i][1] - Th[i][1]) + 1)%(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 | 966 Byte |
Status | WA |
Exec Time | 2106 ms |
Memory | 34440 KB |
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||||||
Status |
|
|
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 | 18 ms | 3064 KB |
0_001.txt | AC | 17 ms | 3064 KB |
0_002.txt | WA | 17 ms | 3064 KB |
0_003.txt | AC | 17 ms | 3064 KB |
1_004.txt | AC | 18 ms | 3064 KB |
1_005.txt | AC | 17 ms | 3064 KB |
1_006.txt | AC | 17 ms | 3064 KB |
1_007.txt | AC | 17 ms | 3064 KB |
1_008.txt | WA | 255 ms | 32832 KB |
1_009.txt | AC | 222 ms | 32728 KB |
1_010.txt | WA | 232 ms | 32748 KB |
1_011.txt | TLE | 2106 ms | 32752 KB |
1_012.txt | AC | 307 ms | 32320 KB |
1_013.txt | TLE | 2106 ms | 32324 KB |
1_014.txt | AC | 362 ms | 32812 KB |
1_015.txt | TLE | 2106 ms | 32356 KB |
1_016.txt | AC | 634 ms | 34440 KB |
1_017.txt | TLE | 2106 ms | 31624 KB |
1_018.txt | TLE | 2106 ms | 31788 KB |
1_019.txt | TLE | 2106 ms | 30328 KB |
1_020.txt | AC | 1233 ms | 30376 KB |