結果
問題 |
No.1681 +-*
|
ユーザー |
|
提出日時 | 2021-09-17 23:32:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 431 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 82,320 KB |
実行使用メモリ | 268,152 KB |
最終ジャッジ日時 | 2024-06-29 22:20:37 |
合計ジャッジ時間 | 4,786 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | WA * 6 TLE * 1 -- * 11 |
ソースコード
import bisect,collections,itertools,math,functools,heapq import sys sys.setrecursionlimit(10**6) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def I(): return int(sys.stdin.readline().rstrip()) N=I() A=LI() ans = 1 mod = 10**9+7 n = 0 sums = 0 for i in range(N): ans *= A[i] ans %= mod if i>=2: if n==0: n = A[0] n *= A[i-1] ans += n * (N-1) ans += 3**(N-1) - N ans %= mod print(ans)