結果
問題 | No.1336 Union on Blackboard |
ユーザー | gorugo30 |
提出日時 | 2021-01-15 21:46:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 343 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 64,512 KB |
最終ジャッジ日時 | 2024-11-26 13:57:59 |
合計ジャッジ時間 | 3,083 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)