結果

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

ソースコード

diff #

#include<stdio.h>
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