結果
| 問題 |
No.1336 Union on Blackboard
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-15 21:57:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 765 bytes |
| コンパイル時間 | 2,459 ms |
| コンパイル使用メモリ | 194,556 KB |
| 最終ジャッジ日時 | 2025-01-17 19:19:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 31 |
ソースコード
/**
* author: shu8Cream
* created: 15.01.2021 21:11:10
**/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int mod = 1e9+7;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t;
cin >> t;
while(t--){
int n; cin >> n;
vector<ll> a(n);
rep(i,n) cin >> a[i];
int last=0;
rep(i,n-1){
int len = a.size();
last=a[len-1]+a[len-2] + a[len-1]*a[len-2];
a.pop_back();
a.pop_back();
a.push_back(last);
}
cout << last%mod << endl;
}
}