結果
| 問題 | No.1681 +-* |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-17 23:32:37 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 232 ms |
| コンパイル使用メモリ | 85,060 KB |
| 実行使用メモリ | 414,272 KB |
| 最終ジャッジ日時 | 2026-03-19 13:08:44 |
| 合計ジャッジ時間 | 26,251 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | WA * 10 TLE * 8 |
ソースコード
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)