結果
問題 |
No.1172 Add Recursive Sequence
|
ユーザー |
![]() |
提出日時 | 2020-08-14 21:31:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,172 bytes |
コンパイル時間 | 3,760 ms |
コンパイル使用メモリ | 195,344 KB |
最終ジャッジ日時 | 2025-01-12 23:19:11 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 TLE * 4 |
ソースコード
#pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; using Int = long long; const char newl = '\n'; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);} template<typename T=int> vector<T> read(size_t n){ vector<T> ts(n); for(size_t i=0;i<n;i++) cin>>ts[i]; return ts; } //INSERT ABOVE HERE const int MAX = 2e5; 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); 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; }