結果

問題 No.2770 Coupon Optimization
ユーザー kotatsugame
提出日時 2024-05-31 21:57:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 268 ms / 3,000 ms
コード長 555 bytes
コンパイル時間 2,220 ms
コンパイル使用メモリ 105,884 KB
実行使用メモリ 24,520 KB
最終ジャッジ日時 2024-12-20 23:20:19
合計ジャッジ時間 7,483 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<atcoder/convolution>
using namespace std;
int N,M;
int A[2<<17],B[2<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		A[i]/=100;
	}
	for(int i=0;i<M;i++)cin>>B[i];
	sort(A,A+N);
	sort(B,B+M);
	reverse(B,B+M);
	vector<long long>C=atcoder::convolution_ll(vector<long long>(A,A+N),vector<long long>(B,B+M));
	long long base=0;
	for(int k=1;k<=N;k++)
	{
		base+=A[k-1]*100;
		cout<<base-C[k-1]<<"\n";
	}
}
0