結果
| 問題 |
No.1618 Convolution?
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2021-07-22 21:44:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 755 bytes |
| コンパイル時間 | 1,840 ms |
| コンパイル使用メモリ | 195,420 KB |
| 最終ジャッジ日時 | 2025-01-23 06:26:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<ll> a(n + 1), b(n + 1);
for (int i = 0; i < n; i++) {
int t;
cin >> t;
a[i + 1] = a[i] + t;
}
for (int i = 0; i < n; i++) {
int t;
cin >> t;
b[i + 1] = b[i] + t;
a[i + 1] += b[i + 1];
}
vector<ll> c(n * 2);
for (int i = 0; i < n; i++) {
c[i + 1] = c[i] + a[i + 1];
}
for (int i = 0; i < n - 1; i++) {
c[n + i + 1] = c[n + i] - (a[i + 1] - a[i]) * n + a[n] - a[i + 1];
}
for (int i = 0; i < n * 2; i++) {
cout << c[i] << " \n"[i == n * 2 - 1];
}
return 0;
}
merom686