結果

問題 No.1172 Add Recursive Sequence
ユーザー kiyoshi0205kiyoshi0205
提出日時 2021-06-13 04:00:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,764 ms / 4,000 ms
コード長 594 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 30,804 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 05:05:32
合計ジャッジ時間 12,150 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 28 ms
4,376 KB
testcase_11 AC 25 ms
4,380 KB
testcase_12 AC 93 ms
4,380 KB
testcase_13 AC 83 ms
4,380 KB
testcase_14 AC 1,090 ms
4,376 KB
testcase_15 AC 3,656 ms
4,376 KB
testcase_16 AC 1,148 ms
4,380 KB
testcase_17 AC 3,764 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
constexpr int mod=1000000007;
int K,N,M,a[100000];
long long c[200],x[100000];
int main(){
  scanf("%d %d %d",&K,&N,&M);
  for(int i=0;i<K;++i)scanf("%d",&a[i]);
  for(int i=0;i<K;++i)scanf("%lld",&c[i]);
  for(int i=K;i<N;++i){
    long long t=0;
    for(int j=0;j<K;++j)t+=c[j]*a[i-j-1]%mod;
    a[i]=t%mod;
  }
  for(int i=0;i<M;++i){
    int l,r;
    scanf("%d %d",&l,&r);
    r-=l;
    for(int i=0;i<r;++i)x[i+l]+=a[i];
  }
  for(int i=0;i<N;++i)printf("%d\n",int(x[i]%mod));
}
0