結果
問題 | No.1307 Rotate and Accumulate |
ユーザー | penguinman |
提出日時 | 2020-12-04 04:00:57 |
言語 | C (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 1,116 ms |
コンパイル使用メモリ | 28,960 KB |
実行使用メモリ | 7,044 KB |
最終ジャッジ日時 | 2023-10-12 15:51:46 |
合計ジャッジ時間 | 33,022 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 0 ms
4,352 KB |
testcase_02 | AC | 1 ms
4,352 KB |
testcase_03 | AC | 0 ms
4,348 KB |
testcase_04 | AC | 0 ms
4,352 KB |
testcase_05 | AC | 0 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,356 KB |
testcase_07 | AC | 1 ms
4,352 KB |
testcase_08 | AC | 4,181 ms
4,352 KB |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | AC | 2,343 ms
4,352 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 159 ms
4,352 KB |
testcase_14 | AC | 1,310 ms
4,352 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
ソースコード
#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 c=cnt[i]; for(int j=0;j<N;j++){ int mem=A[i],d=c; while(d){ if(d&1) B[j]+=mem; mem<<=1; d>>=1; } i++; if(i==N) i=0; } } for(int i=0;i<N;i++) printf("%d ",B[i]); }