結果

問題 No.2549 Paint Eggs
ユーザー cho435cho435
提出日時 2023-11-26 23:01:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 717 bytes
コンパイル時間 4,937 ms
コンパイル使用メモリ 264,840 KB
実行使用メモリ 12,296 KB
最終ジャッジ日時 2023-11-26 23:01:45
合計ジャッジ時間 12,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 3 ms
6,548 KB
testcase_03 AC 3 ms
6,548 KB
testcase_04 AC 3 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 3 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 3 ms
6,548 KB
testcase_10 AC 128 ms
11,352 KB
testcase_11 AC 125 ms
11,320 KB
testcase_12 AC 99 ms
8,320 KB
testcase_13 AC 124 ms
11,088 KB
testcase_14 AC 89 ms
10,376 KB
testcase_15 AC 10 ms
6,548 KB
testcase_16 AC 111 ms
8,832 KB
testcase_17 AC 80 ms
7,680 KB
testcase_18 AC 64 ms
6,548 KB
testcase_19 AC 95 ms
8,192 KB
testcase_20 AC 171 ms
12,296 KB
testcase_21 AC 169 ms
12,296 KB
testcase_22 AC 176 ms
12,296 KB
testcase_23 AC 170 ms
12,296 KB
testcase_24 AC 177 ms
12,296 KB
testcase_25 AC 152 ms
12,296 KB
testcase_26 AC 154 ms
12,296 KB
testcase_27 AC 161 ms
12,296 KB
testcase_28 AC 174 ms
12,296 KB
testcase_29 AC 167 ms
12,296 KB
testcase_30 AC 178 ms
12,296 KB
testcase_31 AC 161 ms
12,296 KB
testcase_32 AC 166 ms
12,296 KB
testcase_33 AC 161 ms
12,296 KB
testcase_34 AC 161 ms
12,296 KB
testcase_35 AC 197 ms
12,296 KB
testcase_36 AC 170 ms
12,296 KB
testcase_37 AC 166 ms
12,296 KB
testcase_38 AC 158 ms
12,296 KB
testcase_39 AC 162 ms
12,296 KB
testcase_40 AC 185 ms
12,296 KB
testcase_41 AC 177 ms
12,296 KB
testcase_42 AC 177 ms
12,296 KB
testcase_43 AC 176 ms
12,296 KB
testcase_44 AC 175 ms
12,296 KB
権限があれば一括ダウンロードができます

ソースコード

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(c.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