結果

問題 No.1172 Add Recursive Sequence
ユーザー optopt
提出日時 2020-04-27 18:53:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,313 bytes
コンパイル時間 2,257 ms
コンパイル使用メモリ 198,120 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-04-17 06:56:25
合計ジャッジ時間 11,428 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 68 ms
5,376 KB
testcase_11 AC 60 ms
5,376 KB
testcase_12 AC 250 ms
5,376 KB
testcase_13 AC 219 ms
5,376 KB
testcase_14 AC 2,893 ms
5,376 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define rep(i, n) rep2(i, 0, n)
using ll = long long;
const int MOD = int(1e9) + 7;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;


struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) { if ((x += a.x) >= MOD) x -= MOD; return *this; }
  mint& operator-=(const mint a) { if ((x += MOD-a.x) >= MOD) x -= MOD; return *this; }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
};
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
using Vm = vector<mint>;


int main() {
  ll k, n, m; cin >> k >> n >> m;
  Vm a(k+n), c(k+1);
  c[0] = -1;
  rep(i, k) { int x; cin >> x; a[i] = x; }
  rep(i, k) { int x; cin >> x; c[i+1] = x; }
  rep2(i, k, n+k) rep2(j, 1, k+1) a[i] += c[j]*a[i-j];

  Vm x(n);
  rep(_, m) {
    int l, r; cin >> l >> r;
    rep2(i, l, r) x[i] += a[i-l];
  }

  rep(i, n) cout << x[i] << "\n";
  return 0;
}
0