Submission #946165
Source Code Expand
#coding: utf-8
def main():
N = int(input())
t = list(map(int, input().split()))
a = list(reversed(list(map(int, input().split()))))
m = [0] * N
b = 0
for i,h in enumerate(t):
if b != h:
m[i] = h#確定
if a[N-i-1] < h:
print(0)
return
b = h
b = 0
for j,h in enumerate(a):
p = N-j-1
if b != h:
if m[p] != 0 and m[p] != h:
print(0)
return
else:
m[p] = h#確定
if t[p] < h:
print(0)
return
b = h
res = 1
for k,h in enumerate(m):
if h == 0:
res = res * min(a[N-k-1], t[k]) % (pow(10, 9) + 7)
print(res)
return
main()
Submission Info
| Submission Time | |
|---|---|
| Task | C - Two Alpinists |
| User | ha1f |
| Language | Python (3.4.3) |
| Score | 400 |
| Code Size | 848 Byte |
| Status | AC |
| Exec Time | 176 ms |
| Memory | 19136 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 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 | 22 ms | 3064 KiB |
| 0_001.txt | AC | 22 ms | 3064 KiB |
| 0_002.txt | AC | 22 ms | 3064 KiB |
| 0_003.txt | AC | 22 ms | 3064 KiB |
| 1_004.txt | AC | 22 ms | 3064 KiB |
| 1_005.txt | AC | 22 ms | 3064 KiB |
| 1_006.txt | AC | 22 ms | 3064 KiB |
| 1_007.txt | AC | 22 ms | 3064 KiB |
| 1_008.txt | AC | 176 ms | 18752 KiB |
| 1_009.txt | AC | 116 ms | 18496 KiB |
| 1_010.txt | AC | 137 ms | 18004 KiB |
| 1_011.txt | AC | 159 ms | 18416 KiB |
| 1_012.txt | AC | 89 ms | 19136 KiB |
| 1_013.txt | AC | 174 ms | 19012 KiB |
| 1_014.txt | AC | 89 ms | 18352 KiB |
| 1_015.txt | AC | 174 ms | 18276 KiB |
| 1_016.txt | AC | 88 ms | 18228 KiB |
| 1_017.txt | AC | 170 ms | 16924 KiB |
| 1_018.txt | AC | 86 ms | 16960 KiB |
| 1_019.txt | AC | 159 ms | 15224 KiB |
| 1_020.txt | AC | 78 ms | 13536 KiB |