結果

問題 No.1307 Rotate and Accumulate
ユーザー chocoruskchocorusk
提出日時 2020-12-04 00:30:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 1,051 bytes
コンパイル時間 3,815 ms
コンパイル使用メモリ 195,660 KB
実行使用メモリ 12,356 KB
最終ジャッジ日時 2023-10-12 11:09:35
合計ジャッジ時間 6,714 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 57 ms
8,728 KB
testcase_09 AC 62 ms
9,040 KB
testcase_10 AC 77 ms
7,892 KB
testcase_11 AC 49 ms
8,156 KB
testcase_12 AC 73 ms
7,916 KB
testcase_13 AC 25 ms
4,348 KB
testcase_14 AC 37 ms
5,568 KB
testcase_15 AC 125 ms
12,208 KB
testcase_16 AC 123 ms
12,320 KB
testcase_17 AC 125 ms
12,332 KB
testcase_18 AC 105 ms
12,128 KB
testcase_19 AC 127 ms
12,356 KB
testcase_20 AC 129 ms
12,152 KB
testcase_21 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n, q; cin>>n>>q;
    int a[100010];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    int r[200020];
    for(int i=0; i<q; i++){
        cin>>r[i];
    }
    vector<ll> v(2*n), w(n+1);
    for(int i=0; i<n; i++){
        v[i]=v[i+n]=a[i];
    }
    for(int i=0; i<q; i++){
        w[n-r[i]]++;
    }
    auto p=convolution(v, w);
    for(int i=n; i<2*n; i++){
        cout<<p[i]<<" ";
    }
    cout<<endl;
    return 0;
}
0