結果

問題 No.2549 Paint Eggs
ユーザー FplusFplusFFplusFplusF
提出日時 2023-11-25 14:44:08
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,416 bytes
コンパイル時間 2,997 ms
コンパイル使用メモリ 254,248 KB
実行使用メモリ 18,752 KB
最終ジャッジ日時 2023-11-25 14:44:26
合計ジャッジ時間 15,355 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
6,676 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 221 ms
16,672 KB
testcase_11 AC 187 ms
17,736 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 112 ms
15,576 KB
testcase_15 AC 17 ms
6,676 KB
testcase_16 WA -
testcase_17 AC 175 ms
10,112 KB
testcase_18 AC 115 ms
8,064 KB
testcase_19 AC 180 ms
11,392 KB
testcase_20 WA -
testcase_21 AC 325 ms
18,752 KB
testcase_22 AC 363 ms
18,752 KB
testcase_23 AC 356 ms
18,752 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 232 ms
18,752 KB
testcase_27 AC 263 ms
18,752 KB
testcase_28 AC 390 ms
18,752 KB
testcase_29 AC 303 ms
18,752 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 324 ms
18,752 KB
testcase_33 AC 290 ms
18,752 KB
testcase_34 AC 260 ms
18,752 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 313 ms
18,752 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 378 ms
18,752 KB
testcase_41 AC 382 ms
18,752 KB
testcase_42 AC 414 ms
18,752 KB
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
    }
}
ll op(ll a,ll b){
    return min(a,b);
}
ll e(){
    return INF;
}
ll mapping(ll f,ll x){
    return x+f;
}
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<ll,op,e,ll,mapping,composition,id> seg(m);
    rep(i,m) seg.set(i,0);
    ll ans=INF;
    for(ll i=k-1;i<n;i++){
        if(i==k-1){
            rep(j,k){
                seg.apply(0,c[j],1);
                seg.apply(c[j]+1,m,1);
            }
        }else{
            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,seg.get(c[i])*a[c[i]]);
        chmin(ans,seg.get(c[i-k+1])*a[c[i-k+1]]);
    }
    cout << ans << '\n';
}
0