結果

問題 No.1307 Rotate and Accumulate
ユーザー penguinman
提出日時 2020-12-04 04:52:08
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 404 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 9,248 KB
最終ジャッジ日時 2024-09-14 15:18:23
合計ジャッジ時間 7,294 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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