Submission #947152
Source Code Expand
import math as mt
import operator as op
def ncr(n, r):
r = min(r, n-r)
if r == 0: return 1
numer = reduce(op.mul, xrange(n, n-r, -1))
denom = reduce(op.mul, xrange(1, r+1))
return numer//denom
N = input()
T = map(lambda x:int(x), raw_input().split())
A = map(lambda x:int(x), raw_input().split())
check = [False for x in range(N)]
check[0] = True
check[N - 1] = True
ans = N - 2
n = max(T)
for i in range(1, len(T) - 1):
if T[i - 1] < T[i]:
global LastT
LastT = T[i]
check[i] = True
if A[i + 1] < A[i]:
global LastA
LastA = A[i]
check[i] = True
if max(T) != max(A):
print 0
else:
if (((N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7)) % (10 ** 9 + 7)) ** 2) % (10 ** 9 + 7) == 0:
print 1
else:
print (((N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7)) % (10 ** 9 + 7)) ** 2) % (10 ** 9 + 7)
#print ncr((n % (10 ** 9 + 7) - (N % (10 ** 9 + 7) - sum(check) % (10 ** 9 + 7))) % (10 ** 9 + 7), ((N - sum(check)) % (10 ** 9 + 7)))
Submission Info
| Submission Time | |
|---|---|
| Task | C - Two Alpinists |
| User | rerost |
| Language | Python (2.7.6) |
| Score | 0 |
| Code Size | 1077 Byte |
| Status | WA |
| Exec Time | 189 ms |
| Memory | 14556 KiB |
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 | 17 ms | 2696 KiB |
| 0_001.txt | AC | 17 ms | 2696 KiB |
| 0_002.txt | WA | 17 ms | 2696 KiB |
| 0_003.txt | AC | 16 ms | 2696 KiB |
| 1_004.txt | AC | 17 ms | 2696 KiB |
| 1_005.txt | WA | 17 ms | 2696 KiB |
| 1_006.txt | WA | 17 ms | 2696 KiB |
| 1_007.txt | AC | 16 ms | 2696 KiB |
| 1_008.txt | WA | 165 ms | 14540 KiB |
| 1_009.txt | AC | 189 ms | 14556 KiB |
| 1_010.txt | WA | 173 ms | 14472 KiB |
| 1_011.txt | WA | 170 ms | 14536 KiB |
| 1_012.txt | WA | 174 ms | 14540 KiB |
| 1_013.txt | WA | 167 ms | 14536 KiB |
| 1_014.txt | WA | 167 ms | 14520 KiB |
| 1_015.txt | WA | 166 ms | 14528 KiB |
| 1_016.txt | WA | 167 ms | 14548 KiB |
| 1_017.txt | WA | 161 ms | 13504 KiB |
| 1_018.txt | WA | 165 ms | 13704 KiB |
| 1_019.txt | WA | 165 ms | 12376 KiB |
| 1_020.txt | WA | 155 ms | 11500 KiB |