結果

問題 No.2549 Paint Eggs
ユーザー FplusFplusFFplusFplusF
提出日時 2023-11-25 13:56:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,430 bytes
コンパイル時間 3,388 ms
コンパイル使用メモリ 257,664 KB
実行使用メモリ 47,048 KB
最終ジャッジ日時 2023-11-25 13:57:22
合計ジャッジ時間 21,654 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 3 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 400 ms
42,864 KB
testcase_11 AC 325 ms
45,872 KB
testcase_12 AC 367 ms
25,104 KB
testcase_13 AC 443 ms
42,440 KB
testcase_14 AC 205 ms
41,696 KB
testcase_15 AC 29 ms
6,676 KB
testcase_16 AC 330 ms
27,872 KB
testcase_17 AC 325 ms
23,064 KB
testcase_18 AC 202 ms
15,464 KB
testcase_19 AC 299 ms
25,704 KB
testcase_20 AC 533 ms
47,048 KB
testcase_21 AC 559 ms
47,048 KB
testcase_22 AC 582 ms
47,048 KB
testcase_23 AC 603 ms
47,048 KB
testcase_24 AC 626 ms
47,048 KB
testcase_25 AC 432 ms
47,048 KB
testcase_26 AC 405 ms
47,048 KB
testcase_27 AC 451 ms
47,048 KB
testcase_28 AC 622 ms
47,048 KB
testcase_29 AC 508 ms
47,048 KB
testcase_30 AC 621 ms
47,048 KB
testcase_31 AC 470 ms
47,048 KB
testcase_32 AC 549 ms
47,048 KB
testcase_33 AC 486 ms
47,048 KB
testcase_34 AC 445 ms
47,048 KB
testcase_35 AC 641 ms
47,048 KB
testcase_36 AC 571 ms
47,048 KB
testcase_37 AC 549 ms
47,048 KB
testcase_38 AC 464 ms
47,048 KB
testcase_39 WA -
testcase_40 AC 631 ms
47,048 KB
testcase_41 AC 630 ms
47,048 KB
testcase_42 AC 614 ms
47,048 KB
testcase_43 AC 614 ms
47,048 KB
testcase_44 AC 615 ms
47,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
struct s{
    __int128 v,k,a;
    
};
bool operator<(s a,s b){
    return a.v<b.v;
}
s op(s a,s b){
    return min(a,b);
}
s e(){
    return {INF,INF,INF};
}
s mapping(ll f,s x){
    s ret=x;
    ret.k+=f;
    ret.v=ret.a*ret.k;
    return ret;
}
ll composition(ll f,ll g){
    return f+g;
}
ll id(){
    return 0;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,m,k;
    cin >> n >> m >> k;
    vector<vector<ll>> v(m);
    vector<ll> c(n);
    rep(i,n){
        cin >> c[i];
        c[i]--;
    }
    vector<ll> a(m);
    rep(i,m) cin >> a[i];
    atcoder::lazy_segtree<s,op,e,ll,mapping,composition,id> seg(m);
    rep(i,m) seg.set(i,{0,0,a[i]});
    rep(i,k){
        seg.apply(0,c[i],1);
        seg.apply(c[i]+1,m,1);
    }
    ll ans=seg.all_prod().v;
    for(ll i=k;i<n;i++){
        seg.apply(0,c[i-k],-1);
        seg.apply(c[i-k]+1,m,-1);
        seg.apply(0,c[i],1);
        seg.apply(c[i]+1,m,1);
        chmin(ans,(ll)seg.all_prod().v);
    }
    cout << ans << '\n';
}
0