結果

問題 No.1618 Convolution?
ユーザー 👑 NachiaNachia
提出日時 2021-07-22 22:03:48
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 77,964 KB
実行使用メモリ 12,576 KB
最終ジャッジ日時 2023-09-24 17:02:57
合計ジャッジ時間 6,721 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 87 ms
10,472 KB
testcase_03 AC 98 ms
11,932 KB
testcase_04 AC 104 ms
8,760 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 133 ms
10,884 KB
testcase_07 AC 135 ms
10,876 KB
testcase_08 AC 103 ms
9,404 KB
testcase_09 AC 160 ms
12,248 KB
testcase_10 AC 108 ms
9,296 KB
testcase_11 AC 146 ms
11,756 KB
testcase_12 AC 168 ms
12,408 KB
testcase_13 AC 164 ms
12,576 KB
testcase_14 AC 171 ms
12,408 KB
testcase_15 AC 167 ms
12,492 KB
testcase_16 AC 167 ms
12,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
vector<ll> A,B;

vector<ll> get_transformed(int n){
  vector<ll> res(n*2+1);
  vector<ll> res2(n*2+1);
  rep(i,n){
    ll a; cin >> a;
    res[i+1] += a;
    res[i+1+n] -= a;
    res2[i+1+n] -= a*n;
  }
  rep(i,n*2) res[i+1] += res[i];
  rep(i,n*2) res[i] += res2[i];
  rep(i,n*2) res[i+1] += res[i];
  res.pop_back();
  return move(res);
}

int main(){
  cin >> N;
  A = get_transformed(N);
  B = get_transformed(N);
  rep(i,2*N) A[i] += B[i];
  rep(i,2*N){ if(i) cout << " "; cout << A[i]; } cout << "\n";
  return 0;
}

0