結果
問題 | No.1336 Union on Blackboard |
ユーザー |
|
提出日時 | 2021-05-28 00:20:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 1,623 ms |
コンパイル使用メモリ | 168,340 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 17:58:43 |
合計ジャッジ時間 | 2,931 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long long#define rep(i, n) for (int i = 0; i < (n); i++)#define P pair<int, int>const ll MOD = 1e9+7;int main() {int t;cin >> t;rep(ti, t) {int n;cin >> n;vector<ll> a(n);rep(i,n) cin >> a[i];rep(i,n-1) {a[i+1] = a[i]+a[i+1]+a[i]*a[i+1];a[i+1] %= MOD;}cout << a[n-1] << endl;}}