結果

問題 No.1618 Convolution?
ユーザー auauaauaua
提出日時 2021-07-22 21:55:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 1,270 bytes
コンパイル時間 2,840 ms
コンパイル使用メモリ 166,104 KB
実行使用メモリ 9,364 KB
最終ジャッジ日時 2023-09-24 16:45:02
合計ジャッジ時間 7,302 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 72 ms
8,028 KB
testcase_03 AC 86 ms
8,700 KB
testcase_04 AC 95 ms
7,024 KB
testcase_05 AC 9 ms
4,380 KB
testcase_06 AC 120 ms
8,032 KB
testcase_07 AC 123 ms
7,980 KB
testcase_08 AC 97 ms
6,928 KB
testcase_09 AC 148 ms
9,192 KB
testcase_10 AC 102 ms
7,228 KB
testcase_11 AC 141 ms
8,812 KB
testcase_12 AC 156 ms
9,232 KB
testcase_13 AC 156 ms
9,300 KB
testcase_14 AC 154 ms
9,236 KB
testcase_15 AC 160 ms
9,364 KB
testcase_16 AC 155 ms
9,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
//#define vec vector<ll>
//#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=998244353;
const ll inf=INF*INF;
const ll mod=INF;
const ll MAX=1000010;
const double PI=acos(-1.0);
typedef vector<vector<ll> > mat;
typedef vector<ll> vec;





signed main(){
    ll n;cin>>n;
    vector<ll>a(n),b(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    ll sa=0,sb=0;
    ll ssa=0,ssb=0;
    vector<ll>c(n*2);
    rep(i,n){
        sa+=a[i];
        ssa+=sa;
        sb+=b[i];
        ssb+=sb;
        c[i+1]=ssb+ssa;
    }
    REP(i,n,2*n-1){
        sa-=a[i-n];
        ssa-=a[i-n]*n;
        ssa+=sa;
        sb-=b[i-n];
        ssb-=b[i-n]*n;
        ssb+=sb;
        c[i+1]=ssb+ssa;
    }
    rep(i,2*n){
        cout<<c[i]<<' ';
    }
    cout<<endl;
}
0