結果

問題 No.1307 Rotate and Accumulate
ユーザー penguinman
提出日時 2020-12-04 04:54:15
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 487 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-09-14 15:20:44
合計ジャッジ時間 25,653 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#pragma GCC optimize ("Ofast")
int i,j,N,Q,A[100000],B[100000],cnt[100000],now;
int main(){
    scanf("%d%d",&N,&Q);
    while(i++!=N) scanf("%d",&A[i-1]);
    while(Q--){
        int now; scanf("%d",&now);
        cnt[now]++;
    }
    while(i--){
        if(cnt[i-1]){
            now=i-1;
            for(j=0;j!=N;j++){
                B[j]+=A[now]*cnt[i-1];
                if(++now==N) now=0;
            }
        }
    }
    while(i++!=N-1) printf("%d ",B[i]);
}
0