結果
| 問題 | No.1307 Rotate and Accumulate |
| コンテスト | |
| ユーザー |
penguinman
|
| 提出日時 | 2020-12-04 02:15:45 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 24,320 KB |
| 実行使用メモリ | 7,680 KB |
| 最終ジャッジ日時 | 2024-09-14 12:59:15 |
| 合計ジャッジ時間 | 20,509 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 TLE * 1 -- * 6 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d",&N,&Q);
| ^~~~~~~~~~~~~~~~~~~
main.c:8:26: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | for(int i=0;i<N;i++) scanf("%d",&A[i]);
| ^~~~~~~~~~~~~~~~~
main.c:10:18: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | int now; scanf("%d",&now);
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int N,Q,A[100000],B[100000],cnt[100000];
int main(){
scanf("%d%d",&N,&Q);
for(int i=0;i<N;i++) scanf("%d",&A[i]);
while(Q--){
int now; scanf("%d",&now);
cnt[now]++;
}
for(int i=0;i<N;i++){
if(!cnt[i]) continue;
int now=i;
for(int j=0;j<N;j++){
if(now==N) now=0;
B[j]+=A[now]*cnt[i];
now++;
}
}
for(int i=0;i<N;i++) printf("%d ",B[i]);
}
penguinman