結果

問題 No.1334 Multiply or Add
ユーザー tobusakanatobusakana
提出日時 2023-09-07 20:44:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 86,476 KB
実行使用メモリ 106,080 KB
最終ジャッジ日時 2023-09-07 20:44:24
合計ジャッジ時間 16,343 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,324 KB
testcase_01 AC 99 ms
71,276 KB
testcase_02 AC 95 ms
71,256 KB
testcase_03 AC 150 ms
105,936 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 152 ms
105,676 KB
testcase_07 AC 148 ms
105,680 KB
testcase_08 WA -
testcase_09 AC 154 ms
105,316 KB
testcase_10 AC 153 ms
105,964 KB
testcase_11 AC 161 ms
105,280 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 159 ms
105,900 KB
testcase_17 AC 147 ms
105,672 KB
testcase_18 AC 175 ms
105,708 KB
testcase_19 AC 145 ms
105,272 KB
testcase_20 AC 151 ms
106,080 KB
testcase_21 AC 157 ms
105,496 KB
testcase_22 WA -
testcase_23 AC 152 ms
105,940 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 149 ms
105,464 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 178 ms
106,068 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 158 ms
99,864 KB
testcase_51 AC 157 ms
100,272 KB
testcase_52 AC 155 ms
99,928 KB
testcase_53 AC 157 ms
100,188 KB
testcase_54 AC 157 ms
100,304 KB
testcase_55 AC 183 ms
104,952 KB
testcase_56 AC 97 ms
71,300 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 97 ms
71,372 KB
testcase_60 AC 94 ms
71,300 KB
testcase_61 AC 95 ms
71,524 KB
testcase_62 AC 98 ms
71,208 KB
testcase_63 AC 98 ms
71,348 KB
testcase_64 AC 97 ms
71,524 KB
testcase_65 AC 104 ms
71,352 KB
testcase_66 AC 142 ms
101,208 KB
testcase_67 AC 131 ms
94,616 KB
testcase_68 AC 101 ms
76,756 KB
testcase_69 AC 153 ms
99,744 KB
testcase_70 AC 150 ms
99,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# はじにある1は足したほうがよい
N = int(input())
A = list(map(int,input().split()))

from collections import deque
q = deque(A)
DIV = 10 ** 9 + 7

ans = 0
while q:
    found = False
    if q[0] == 1:
        ans += 1
        q.popleft()
        found = True
    elif q[-1] == 1:
        ans += 1
        q.pop()
        found = True
    if not found:
        break
    
def f(X):
    res = 1
    for x in X:
        res *= x
        res %= DIV
    return res
    
print((ans + f(q)) % DIV)
0