結果
問題 | No.1618 Convolution? |
ユーザー | firiexp |
提出日時 | 2021-07-22 21:57:55 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 869 ms |
コンパイル使用メモリ | 102,852 KB |
実行使用メモリ | 9,584 KB |
最終ジャッジ日時 | 2023-09-24 16:49:50 |
合計ジャッジ時間 | 6,042 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 59 ms
7,916 KB |
testcase_03 | AC | 71 ms
8,968 KB |
testcase_04 | AC | 61 ms
7,124 KB |
testcase_05 | AC | 6 ms
4,376 KB |
testcase_06 | AC | 79 ms
8,128 KB |
testcase_07 | AC | 79 ms
8,400 KB |
testcase_08 | AC | 62 ms
7,208 KB |
testcase_09 | AC | 95 ms
9,128 KB |
testcase_10 | AC | 64 ms
7,404 KB |
testcase_11 | AC | 88 ms
9,036 KB |
testcase_12 | AC | 93 ms
9,456 KB |
testcase_13 | AC | 94 ms
9,516 KB |
testcase_14 | AC | 94 ms
9,580 KB |
testcase_15 | AC | 94 ms
9,460 KB |
testcase_16 | AC | 95 ms
9,584 KB |
ソースコード
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using uint = unsigned; using ull = unsigned long long; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208; int main() { int n; cin >> n; vector<ll> a(n), b(n); for (auto &&i : a) scanf("%lld", &i); for (auto &&i : b) scanf("%lld", &i); for (int i = 0; i < n; ++i) { a[i] += b[i]; } vector<ll> S(n+1), T(n+1); for (int i = 0; i < n; ++i) { S[i+1] = S[i] + (i+1)*a[i]; T[i+1] = T[i] + a[i]; } for (int i = 1; i <= 2*n; ++i) { if(i > 1) printf(" "); int l = max(1, i-n), r = min(n, i-1); if(l > r) printf("0"); else printf("%lld", i*(T[r]-T[l-1])-(S[r]-S[l-1])); } puts(""); return 0; }