結果

問題 No.1618 Convolution?
ユーザー Nzt3Nzt3
提出日時 2021-07-22 21:55:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 2,848 ms
コンパイル使用メモリ 166,932 KB
実行使用メモリ 15,660 KB
最終ジャッジ日時 2023-09-24 16:45:22
合計ジャッジ時間 7,219 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 75 ms
12,844 KB
testcase_03 AC 91 ms
14,544 KB
testcase_04 AC 97 ms
11,040 KB
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 126 ms
13,188 KB
testcase_07 AC 126 ms
13,348 KB
testcase_08 AC 99 ms
10,884 KB
testcase_09 AC 150 ms
15,344 KB
testcase_10 AC 105 ms
11,412 KB
testcase_11 AC 142 ms
14,672 KB
testcase_12 AC 161 ms
15,660 KB
testcase_13 AC 157 ms
15,604 KB
testcase_14 AC 159 ms
15,352 KB
testcase_15 AC 158 ms
15,468 KB
testcase_16 AC 159 ms
15,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<long long>A(N),B(N);
  for(auto &i:A)cin>>i;
  for(auto &i:B)cin>>i;
  vector<long long>C(N*2+1),V(N*2+1),T(N*2+1);
  for(int i=0;i<N;i++){
    V[i+1]+=A[i];
    V[i+1]+=B[i];
    T[i+N+1]-=A[i]*N;
    T[i+N+1]-=B[i]*N;
    V[i+N+1]-=A[i];
    V[i+N+1]-=B[i];
  }
  for(long long i=1,t=0,v=0;i<N*2;i++){
    v+=V[i];
    t+=v+T[i];
    C[i]=t;
  }
  for(int i=0;i<N*2;i++)cout<<C[i]<<(i==N*2-1?'\n':' ');
}
0