結果

問題 No.1172 Add Recursive Sequence
ユーザー beetbeet
提出日時 2020-08-14 21:31:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,172 bytes
コンパイル時間 2,854 ms
コンパイル使用メモリ 198,272 KB
実行使用メモリ 10,912 KB
最終ジャッジ日時 2024-04-18 20:50:49
合計ジャッジ時間 12,139 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,948 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 AC 75 ms
6,940 KB
testcase_11 AC 63 ms
6,944 KB
testcase_12 AC 260 ms
6,940 KB
testcase_13 AC 240 ms
6,944 KB
testcase_14 AC 3,095 ms
6,944 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0