結果

問題 No.1618 Convolution?
ユーザー re_re0101
提出日時 2021-07-23 01:10:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 3,076 bytes
コンパイル時間 4,085 ms
コンパイル使用メモリ 236,948 KB
実行使用メモリ 25,584 KB
最終ジャッジ日時 2024-07-17 22:28:42
合計ジャッジ時間 11,574 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize ("O3")
// #pragma GCC target("avx512f")
// #pragma GCC optimize("unroll-loops")
// #ifndef ONLINE_JUDGE
// #define _GLIBCXX_DEBUG
// #endif
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define eb emplace_back
#define endl '\n'
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define PI 3.14159265359
const double eps = 1e-12;
const long long INF= (long long)1e18+20;
const int inf= 1010101010;
typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> Point;  // Point
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl>vvl;
typedef vector<vvl>vvvl;
typedef vector<vvvl>vvvvl;
typedef vector<vvvvl>vvvvvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
template<class T> using minpq=priority_queue<T,vector<T>,greater<T>>;
const ll MOD=1000000007LL;
// const ll MOD=998244353LL;
// using mint=modint998244353;
using mint=modint1000000007;
// using mint=modint;
const ll mod=MOD;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1,1,1,-1,-1};
vl dy={1,-1,0,0,-1,1,-1,1};

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}



typedef vector<mint>vm;
typedef vector<vm>vvm;
typedef vector<vvm>vvvm;
ll modpow(ll a, ll n,ll mod=MOD) {

    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

vector<int>divisor(int n){
  vector<int>res;
  for(int i=1;i*i<=n;i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(n/i);
    }
  }
  return res;
}

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

struct edge{
    ll to;ll cost;
};

ll functional(int x){
    if(x==0)return 1;
    else return x*functional(x-1);
}

ll exp(int n,int r){
    if(r==0)return 1;
    return n*exp(n,r-1);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(12);
    /*--------------------------------*/

    ll n;cin>>n;
    vl a(n),b(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    vl vec(n);
    rep(i,n)vec[i]=i+1;
    vl c1=convolution_ll(a,vec);
    vl c2=convolution_ll(b,vec);
    cout<<0<<" ";
    rep(i,2*n-1){
        cout<<c1[i]+c2[i]<<" \n"[i+1==2*n-1];
    }
}
0