Submission #171653


Source Code Expand

Copy
def C(a,b):
    r = 1
    for i in range(b):
        r *= a-i
    for i in range(b):
        r /= i+1
    return r

N = input()
A = map(int, raw_input().split())
p = -1
ans = 1
for i in range(N):
    if p==-1 and A[i]==-1:
        p = i-1
    if p!=-1 and A[i]!=-1:
        ans *= C(A[i]-A[p]+(i-p-1), i-p-1)
        ans %= 1000000007
        p = -1
print ans

Submission Info

Submission Time
Task C - タコヤ木
User kusano
Language Python (2.7.3)
Score 100
Code Size 380 Byte
Status AC
Exec Time 128 ms
Memory 3484 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 50 / 50 30 / 30 20 / 20
Status
AC × 3
AC × 14
AC × 26
AC × 36
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Subtask2 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Subtask3 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt
Case Name Status Exec Time Memory
sample_01.txt AC 57 ms 3256 KB
sample_02.txt AC 46 ms 3264 KB
sample_03.txt AC 50 ms 3268 KB
subtask1_01.txt AC 49 ms 3256 KB
subtask1_02.txt AC 49 ms 3264 KB
subtask1_03.txt AC 57 ms 3472 KB
subtask1_04.txt AC 51 ms 3268 KB
subtask1_05.txt AC 64 ms 3288 KB
subtask1_06.txt AC 45 ms 3260 KB
subtask1_07.txt AC 50 ms 3260 KB
subtask1_08.txt AC 46 ms 3256 KB
subtask1_09.txt AC 50 ms 3268 KB
subtask1_10.txt AC 66 ms 3260 KB
subtask1_11.txt AC 46 ms 3264 KB
subtask1_12.txt AC 46 ms 3264 KB
subtask2_01.txt AC 46 ms 3268 KB
subtask2_02.txt AC 50 ms 3264 KB
subtask2_03.txt AC 60 ms 3252 KB
subtask2_04.txt AC 48 ms 3264 KB
subtask2_05.txt AC 48 ms 3372 KB
subtask2_06.txt AC 47 ms 3260 KB
subtask2_07.txt AC 76 ms 3476 KB
subtask2_08.txt AC 49 ms 3460 KB
subtask2_09.txt AC 49 ms 3372 KB
subtask2_10.txt AC 48 ms 3376 KB
subtask2_11.txt AC 50 ms 3380 KB
subtask2_12.txt AC 48 ms 3376 KB
subtask3_01.txt AC 47 ms 3272 KB
subtask3_02.txt AC 48 ms 3268 KB
subtask3_03.txt AC 53 ms 3424 KB
subtask3_04.txt AC 49 ms 3476 KB
subtask3_05.txt AC 49 ms 3256 KB
subtask3_06.txt AC 52 ms 3368 KB
subtask3_07.txt AC 128 ms 3468 KB
subtask3_08.txt AC 51 ms 3484 KB
subtask3_09.txt AC 53 ms 3364 KB
subtask3_10.txt AC 53 ms 3376 KB
subtask3_11.txt AC 49 ms 3360 KB
subtask3_12.txt AC 49 ms 3380 KB