結果

問題 No.2549 Paint Eggs
ユーザー cho435cho435
提出日時 2023-11-26 22:59:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 711 bytes
コンパイル時間 4,280 ms
コンパイル使用メモリ 264,964 KB
実行使用メモリ 12,296 KB
最終ジャッジ日時 2023-11-26 22:59:20
合計ジャッジ時間 13,125 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 AC 3 ms
6,676 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 3 ms
6,676 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 9 ms
6,676 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 AC 159 ms
12,296 KB
testcase_21 AC 156 ms
12,296 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 178 ms
12,296 KB
testcase_25 AC 144 ms
12,296 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 161 ms
12,296 KB
testcase_31 AC 169 ms
12,296 KB
testcase_32 AC 155 ms
12,296 KB
testcase_33 AC 151 ms
12,296 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 160 ms
12,296 KB
testcase_37 AC 154 ms
12,296 KB
testcase_38 AC 163 ms
12,296 KB
testcase_39 AC 166 ms
12,296 KB
testcase_40 WA -
testcase_41 AC 163 ms
12,296 KB
testcase_42 WA -
testcase_43 AC 161 ms
12,296 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

ll op(ll a,ll b){
	return min(a,b);
}
ll e(){
	return 1e18;
}
using segtree = atcoder::segtree<ll,op,e>;

int main(){
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> c(n),a(m);
	rep(i,n) cin>>c.at(i),c.at(i)--;
	rep(i,m) cin>>a.at(i);
	vector<ll> vc(m);
	rep(i,m) vc.at(i)=a.at(i)*k;
	rep(i,k){
		vc.at(c.at(i))-=a.at(i);
	}
	segtree sg(vc);
	ll ans=sg.all_prod();
	for(int i=k;i<m;i++){
		sg.set(c.at(i),sg.get(c.at(i))-a.at(c.at(i)));
		sg.set(c.at(i-k),sg.get(c.at(i-k))+a.at(c.at(i-k)));
		ans=min(ans,sg.all_prod());
	}
	cout<<ans<<endl;
}
0