結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 3 ms
6,548 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 AC 3 ms
6,548 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 2 ms
6,548 KB
testcase_10 RE -
testcase_11 AC 131 ms
11,320 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 10 ms
6,548 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 AC 207 ms
12,296 KB
testcase_21 AC 182 ms
12,296 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 214 ms
12,296 KB
testcase_25 AC 152 ms
12,296 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 196 ms
12,296 KB
testcase_31 AC 162 ms
12,296 KB
testcase_32 AC 184 ms
12,296 KB
testcase_33 AC 173 ms
12,296 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 170 ms
12,296 KB
testcase_37 AC 173 ms
12,296 KB
testcase_38 AC 160 ms
12,296 KB
testcase_39 AC 177 ms
12,296 KB
testcase_40 WA -
testcase_41 AC 180 ms
12,296 KB
testcase_42 WA -
testcase_43 AC 190 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<n;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