結果
問題 | No.754 畳み込みの和 |
ユーザー | yuppe19 😺 |
提出日時 | 2018-12-02 08:01:54 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 30 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 560 ms |
コンパイル使用メモリ | 73,664 KB |
実行使用メモリ | 4,664 KB |
最終ジャッジ日時 | 2023-09-10 11:09:51 |
合計ジャッジ時間 | 1,212 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
4,664 KB |
testcase_01 | AC | 29 ms
4,620 KB |
testcase_02 | AC | 30 ms
4,588 KB |
ソースコード
#include <cmath> #include <iostream> #include <vector> using namespace std; using i64 = int64_t; constexpr int mod = static_cast<int>(powl(10, 9)) + 7; int main(void) { int n; scanf("%d", &n); int N = n + 1; vector<i64> a(N), b(N); for(int i=0; i<N; ++i) { scanf("%ld", &a[i]); } for(int i=0; i<N; ++i) { scanf("%ld", &b[i]); } for(int i=0; i<N-1; ++i) { b[i+1] += b[i]; b[i+1] %= mod; } i64 res = 0; for(int i=0; i<N; ++i) { res += a[i] * b[N-1-i] % mod; res %= mod; } printf("%ld\n", res); return 0; }