結果
| 問題 | No.1307 Rotate and Accumulate |
| コンテスト | |
| ユーザー |
penguinman
|
| 提出日時 | 2020-12-04 01:56:40 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 639 bytes |
| 記録 | |
| コンパイル時間 | 2,199 ms |
| コンパイル使用メモリ | 192,984 KB |
| 最終ジャッジ日時 | 2025-01-16 15:31:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int N,Q,r,x,i;
int A[100000],B[100000],cnt[100000];
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
cin>>N>>Q;
for(i=0;i<N;i++) cin>>A[i];
while(Q--){
cin>>r;
cnt[r]++;
}
for(i=0;i<N;i++){
if(cnt[i]){
x=i;
for(r=0;r<N;r++,x++){
if(x==N) x=0;
B[r]+=A[x]*cnt[i];
}
}
}
cout<<B[0];
for(i=1;i<N;i++) cout<<" "<<B[i];
}
penguinman