結果

問題 No.1307 Rotate and Accumulate
ユーザー りあんりあん
提出日時 2020-12-04 01:48:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,963 ms / 5,000 ms
コード長 719 bytes
コンパイル時間 3,135 ms
コンパイル使用メモリ 214,360 KB
実行使用メモリ 4,720 KB
最終ジャッジ日時 2023-10-12 13:06:05
合計ジャッジ時間 19,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,720 KB
testcase_01 AC 2 ms
4,572 KB
testcase_02 AC 2 ms
4,512 KB
testcase_03 AC 2 ms
4,584 KB
testcase_04 AC 2 ms
4,520 KB
testcase_05 AC 2 ms
4,592 KB
testcase_06 AC 2 ms
4,576 KB
testcase_07 AC 3 ms
4,564 KB
testcase_08 AC 884 ms
4,528 KB
testcase_09 AC 965 ms
4,536 KB
testcase_10 AC 415 ms
4,608 KB
testcase_11 AC 746 ms
4,592 KB
testcase_12 AC 448 ms
4,584 KB
testcase_13 AC 15 ms
4,584 KB
testcase_14 AC 109 ms
4,532 KB
testcase_15 AC 1,931 ms
4,516 KB
testcase_16 AC 1,918 ms
4,524 KB
testcase_17 AC 1,927 ms
4,584 KB
testcase_18 AC 1,907 ms
4,524 KB
testcase_19 AC 1,963 ms
4,576 KB
testcase_20 AC 1,895 ms
4,576 KB
testcase_21 AC 2 ms
4,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const long long LM = 1LL << 60;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, q;
    cin >> n >> q;
    int a[200010] = {};
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i + n] = a[i];
    }
    int cnt[100010] = {};
    for (int i = 0; i < q; ++i) {
        int x;
        cin >> x;
        ++cnt[x];
    }
    for (int i = 0; i < n; ++i) {
        int b = 0;
        for (int j = 0; j < n; ++j) {
            b += cnt[j] * a[i + j];
        }
        cout << b << (i + 1 < n ? ' ' : '\n');
    }
    return 0;
}
0