結果
問題 | No.2549 Paint Eggs |
ユーザー |
|
提出日時 | 2023-11-26 22:59:24 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 4,777 ms |
コンパイル使用メモリ | 263,536 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-09-26 11:58:59 |
合計ジャッジ時間 | 11,889 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 16 RE * 8 |
ソースコード
#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; }