結果
| 問題 |
No.1172 Add Recursive Sequence
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-11-14 15:20:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,816 ms / 4,000 ms |
| コード長 | 1,140 bytes |
| コンパイル時間 | 3,239 ms |
| コンパイル使用メモリ | 219,580 KB |
| 最終ジャッジ日時 | 2025-01-16 00:34:42 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
// verification-helper: PROBLEM https://yukicoder.me/problems/4271
#define call_from_test
#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2") // or sse4
#pragma GCC optimize("unroll-loops")
//END CUT HERE
#ifndef call_from_test
signed main(){
return 0;
}
#endif
#undef call_from_test
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
const int MOD = 1e9+7;
using uint = unsigned int;
inline uint add_mod(uint a, uint b) {
return (a += b) >= MOD ? a - MOD : a;
}
uint mul(uint x,uint y){
return 1ULL*x*y%MOD;
}
uint xs[MAX]={};
uint as[MAX]={};
uint cs[MAX]={};
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
const char newl = '\n';
int k,n,m;
cin>>k>>n>>m;
for(int i=0;i<k;i++) cin>>as[i];
for(int i=0;i<k;i++) cin>>cs[i];
for(int i=k;i<n;i++)
for(int j=0;j<k;j++)
as[i]=add_mod(as[i],mul(cs[j],as[i-(j+1)]));
for(int i=0;i<m;i++){
int l,r;
cin>>l>>r;
for(int k=l;k<r;k++) xs[k]=add_mod(xs[k],as[k-l]);
}
for(int i=0;i<n;i++) cout<<xs[i]<<newl;
return 0;
}
beet