結果
問題 | No.1618 Convolution? |
ユーザー | Be11T_ |
提出日時 | 2021-07-22 21:57:33 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 1,416 bytes |
コンパイル時間 | 6,253 ms |
コンパイル使用メモリ | 260,112 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2023-09-24 16:49:13 |
合計ジャッジ時間 | 9,994 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 51 ms
10,300 KB |
testcase_03 | AC | 61 ms
12,028 KB |
testcase_04 | AC | 53 ms
8,900 KB |
testcase_05 | AC | 6 ms
4,376 KB |
testcase_06 | AC | 69 ms
10,808 KB |
testcase_07 | AC | 68 ms
10,828 KB |
testcase_08 | AC | 55 ms
9,236 KB |
testcase_09 | AC | 83 ms
12,596 KB |
testcase_10 | AC | 56 ms
9,372 KB |
testcase_11 | AC | 80 ms
11,740 KB |
testcase_12 | AC | 85 ms
12,600 KB |
testcase_13 | AC | 86 ms
12,672 KB |
testcase_14 | AC | 84 ms
12,672 KB |
testcase_15 | AC | 84 ms
12,284 KB |
testcase_16 | AC | 83 ms
12,480 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; #define rep(i, n) for(ll i = 0; i < n; i++) #define rep2(i, m, n) for(ll i = m; i <= n; i++) #define rrep(i, m, n) for(ll i = m; i >= n; i--) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define MAX(x) *max_element(all(x)) #define MIN(x) *min_element(all(x)) #define SZ(a) ((ll)(a).size()) using namespace std; typedef long long ll; typedef pair<int, int> P; const ll mod = 1000000007; const int dx[4] = { -1, 1, 0, 0 }; const int dy[4] = { 0, 0, 1, -1 }; const int inf = 1e9 + 1; const ll INF = 1e18; const double pi = acos(-1); using Graph = vector<vector<ll>>; //typedef atcoder::modint998244353 mint; //typedef atcoder::modint1000000007 mint; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<ll> c(n); vector<ll> a(n), b(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; rep(i, n) c[i] = a[i] + b[i]; vector<ll> sum(n + 1, 0); rep(i, n) sum[i + 1] = sum[i] + c[i]; vector<ll> res(2 * n); ll cur = 0; rep(i, 2 * n) { if (i < n) { res[i] = cur; cur += sum[i + 1]; } else { res[i] = cur; cur -= n * c[i - n]; cur += sum[n] - sum[i - n + 1]; } } rep(i, 2 * n) { cout << res[i] << " "; } cout << endl; }