結果

問題 No.1307 Rotate and Accumulate
ユーザー HaaHaa
提出日時 2020-12-04 00:35:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 3,627 ms
コンパイル使用メモリ 228,920 KB
実行使用メモリ 5,780 KB
最終ジャッジ日時 2023-10-12 11:17:42
合計ジャッジ時間 7,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=1e18;

int main(){
	int n, q; cin >> n >> q;
	VI a(n); REP(i,n) cin >> a[i];
	VI p(n,0); int r;
	REP(i,q){
		cin >> r;
		p[r]++;
	}
	reverse(ALL(a));
	copy(ALL(p),back_inserter(p));
	VI ans=convolution_ll(a,p);
	for(int i=n*2-1;i>=n;i--)
		cout << ans[i] << " ";
	cout << endl;
	return 0;
}
0