結果

問題 No.1307 Rotate and Accumulate
ユーザー penguinmanpenguinman
提出日時 2020-12-04 04:25:45
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 371 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 28,484 KB
実行使用メモリ 6,684 KB
最終ジャッジ日時 2023-10-12 16:15:51
合計ジャッジ時間 7,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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