結果
| 問題 |
No.1307 Rotate and Accumulate
|
| コンテスト | |
| ユーザー |
IKyopro
|
| 提出日時 | 2020-12-04 14:21:08 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,023 bytes |
| コンパイル時間 | 11,980 ms |
| コンパイル使用メモリ | 272,020 KB |
| 最終ジャッジ日時 | 2025-01-16 15:44:46 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 4 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define rep(i,n) for(int i=0;i<(n);i++)
#define drep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << (x) << endl;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N,Q;
cin >> N >> Q;
vec<int> A(N);
rep(i,N) cin >> A[i];
vec<int> cnt(N);
rep(i,Q){
int r;
cin >> r;
cnt[r]++;
}
vec<int> B(N);
rep(i,N) if(cnt[i]){
rep(j,N){
int t = i+j>=N? i+j-N:i+j;
B[j] += cnt[i]*A[t];
}
}
rep(i,N) cout << B[i] << (i!=N-1? " ":"\n");
}
IKyopro