結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,724 KB
testcase_01 AC 2 ms
4,484 KB
testcase_02 AC 3 ms
4,684 KB
testcase_03 AC 3 ms
4,576 KB
testcase_04 AC 3 ms
4,520 KB
testcase_05 AC 3 ms
4,548 KB
testcase_06 AC 2 ms
4,576 KB
testcase_07 AC 3 ms
4,508 KB
testcase_08 AC 578 ms
4,660 KB
testcase_09 AC 635 ms
4,508 KB
testcase_10 AC 279 ms
4,492 KB
testcase_11 AC 492 ms
4,504 KB
testcase_12 AC 301 ms
4,656 KB
testcase_13 AC 13 ms
4,720 KB
testcase_14 AC 75 ms
4,520 KB
testcase_15 AC 1,326 ms
4,512 KB
testcase_16 AC 1,270 ms
4,524 KB
testcase_17 AC 1,324 ms
4,596 KB
testcase_18 AC 1,304 ms
4,600 KB
testcase_19 AC 1,253 ms
4,792 KB
testcase_20 AC 1,279 ms
4,500 KB
testcase_21 AC 2 ms
4,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#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