結果

問題 No.1172 Add Recursive Sequence
ユーザー もりをもりを
提出日時 2020-08-14 23:33:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 3,238 ms
コンパイル使用メモリ 209,980 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-18 23:17:15
合計ジャッジ時間 14,763 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
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 WA -
testcase_07 AC 4 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

constexpr int MOD = (int)1e9 + 7;
constexpr int MX = 100000;
constexpr int MX_K = 200;

int K, N, M, L, R;
int A[MX + 1], C[MX_K + 1];
ll res[MX + 1], tmp;

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("%d", C + i);
    for (int i = K; i < N; ++i) {
        tmp = 0;
        for (int j = 0; j < K; ++j) tmp += ll(C[j]) * A[i - 1 - j] % MOD;
        A[i] += tmp;
        if (A[i] >= MOD) A[i] -= MOD;
    }
    for (int i = 0; i < M; ++i) {
        scanf("%d%d", &L, &R);
        for (int j = L; j < R; ++j) res[j] += A[j - L];
    }
    for (int i = 0; i < N; ++i) printf("%d\n", res[i] % MOD);
}
0