結果
| 問題 | No.1336 Union on Blackboard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-15 21:46:50 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 305 bytes |
| 記録 | |
| コンパイル時間 | 142 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 64,640 KB |
| 最終ジャッジ日時 | 2026-05-21 00:57:15 |
| 合計ジャッジ時間 | 2,784 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
T = int(input())
MOD = 10 ** 9 + 7
from collections import deque
for case in range(T):
N = int(input())
A = list(map(int, input().split()))
st = deque(A)
while len(st) > 1:
x = st.pop()
y = st.pop()
st.append((x + y + x * y) % MOD)
ans = st.pop()
print(ans)