結果
問題 |
No.1336 Union on Blackboard
|
ユーザー |
|
提出日時 | 2021-01-15 21:40:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 757 bytes |
コンパイル時間 | 2,705 ms |
コンパイル使用メモリ | 194,484 KB |
最終ジャッジ日時 | 2025-01-17 18:47:09 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; vi 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; } }