結果

問題 No.1307 Rotate and Accumulate
ユーザー 👑 testestesttestestest
提出日時 2020-12-04 00:09:38
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 3,062 ms / 5,000 ms
コード長 322 bytes
コンパイル時間 1,469 ms
コンパイル使用メモリ 32,228 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 09:36:45
合計ジャッジ時間 24,342 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 555 ms
6,940 KB
testcase_09 AC 772 ms
6,944 KB
testcase_10 AC 1,116 ms
6,940 KB
testcase_11 AC 283 ms
6,944 KB
testcase_12 AC 1,055 ms
6,940 KB
testcase_13 AC 78 ms
6,948 KB
testcase_14 AC 280 ms
6,940 KB
testcase_15 AC 2,922 ms
6,940 KB
testcase_16 AC 3,062 ms
6,944 KB
testcase_17 AC 2,933 ms
6,940 KB
testcase_18 AC 2,327 ms
6,940 KB
testcase_19 AC 3,036 ms
6,944 KB
testcase_20 AC 2,837 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:4:1: warning: data definition has no type or storage class
    4 | a[100010],b[100010];
      | ^
main.c:4:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:4:11: warning: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    4 | a[100010],b[100010];
      |           ^
main.c:5:1: warning: data definition has no type or storage class
    5 | n,q,i,r;
      | ^
main.c:5:1: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:5:3: warning: type defaults to 'int' in declaration of 'q' [-Wimplicit-int]
    5 | n,q,i,r;
      |   ^
main.c:5:5: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    5 | n,q,i,r;
      |     ^
main.c:5:7: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
    5 | n,q,i,r;
      |       ^
main.c:6:1: warning: return type defaults to 'int' [-Wimplicit-int]
    6 | main(){
      | ^~~~
main.c: In function 'main':
main.c:7:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |         scanf("%d%d",&n,&q);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #pragma GCC target("avx2")
main.c:7:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |         scanf("%d%d",&n,&q);
      |         ^~~~~
main.c:7:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:25: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   14 |         for(i=0;i<n;i++)printf("%d ",b[i]);
      |                         ^~~~~~
main.c:14:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:25: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
a[100010],b[100010];
n,q,i,r;
main(){
	scanf("%d%d",&n,&q);
	for(i=0;i<n;i++)scanf("%d",a+i);
	while(q--){
		scanf("%d",&r);
		for(i=0;i<n-r;i++)b[i]+=a[r+i];
		for(;i<n;i++)b[i]+=a[r+i-n];
	}
	for(i=0;i<n;i++)printf("%d ",b[i]);
}
0