結果

問題 No.1307 Rotate and Accumulate
ユーザー IKyoproIKyopro
提出日時 2020-12-04 14:21:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,023 bytes
コンパイル時間 3,413 ms
コンパイル使用メモリ 216,376 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-13 02:56:32
合計ジャッジ時間 28,473 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 3,401 ms
4,348 KB
testcase_09 AC 4,386 ms
4,348 KB
testcase_10 AC 2,815 ms
4,348 KB
testcase_11 AC 1,983 ms
4,356 KB
testcase_12 AC 2,999 ms
4,348 KB
testcase_13 AC 52 ms
4,352 KB
testcase_14 AC 697 ms
4,348 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define rep(i,n) for(int i=0;i<(n);i++)
#define drep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q;
    cin >> N >> Q;
    vec<int> A(N);
    rep(i,N) cin >> A[i];
    vec<int> cnt(N);
    rep(i,Q){
        int r;
        cin >> r;
        cnt[r]++;
    }
    vec<int> B(N);
    rep(i,N) if(cnt[i]){
        rep(j,N){
            int t = i+j>=N? i+j-N:i+j;
            B[j] += cnt[i]*A[t];
        }
    }
    rep(i,N) cout << B[i] << (i!=N-1? " ":"\n");
}
0