結果

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

テストケース

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

ソースコード

diff #

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