結果

問題 No.2549 Paint Eggs
ユーザー t98slidert98slider
提出日時 2023-11-26 21:53:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 2,421 ms
コンパイル使用メモリ 207,144 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2023-11-26 21:53:28
合計ジャッジ時間 7,830 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
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 86 ms
11,276 KB
testcase_11 AC 57 ms
11,760 KB
testcase_12 AC 63 ms
8,704 KB
testcase_13 AC 75 ms
11,008 KB
testcase_14 AC 41 ms
9,472 KB
testcase_15 AC 6 ms
6,676 KB
testcase_16 AC 71 ms
10,368 KB
testcase_17 AC 52 ms
7,552 KB
testcase_18 AC 41 ms
6,912 KB
testcase_19 AC 57 ms
8,960 KB
testcase_20 AC 96 ms
13,508 KB
testcase_21 AC 94 ms
13,508 KB
testcase_22 AC 100 ms
13,508 KB
testcase_23 AC 94 ms
13,636 KB
testcase_24 AC 94 ms
13,636 KB
testcase_25 AC 94 ms
13,508 KB
testcase_26 AC 93 ms
13,636 KB
testcase_27 AC 95 ms
13,636 KB
testcase_28 AC 95 ms
13,636 KB
testcase_29 AC 105 ms
13,508 KB
testcase_30 AC 95 ms
13,636 KB
testcase_31 AC 98 ms
13,636 KB
testcase_32 AC 93 ms
13,508 KB
testcase_33 AC 93 ms
13,636 KB
testcase_34 AC 92 ms
13,636 KB
testcase_35 AC 104 ms
13,508 KB
testcase_36 AC 92 ms
13,636 KB
testcase_37 AC 92 ms
13,636 KB
testcase_38 AC 92 ms
13,508 KB
testcase_39 AC 104 ms
13,636 KB
testcase_40 AC 95 ms
13,508 KB
testcase_41 AC 94 ms
13,636 KB
testcase_42 AC 93 ms
13,508 KB
testcase_43 AC 94 ms
13,636 KB
testcase_44 AC 93 ms
13,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> tb(m);
    vector<ll> a(m);
    for(int i = 0, v; i < n; i++){
        cin >> v;
        tb[--v].emplace_back(i);
    }
    cin >> a;
    ll ans = 1ll << 61;
    for(int i = 0; i < m; i++){
        ans = min(ans, a[i] * k);
        for(int l = 0, r = 0; l < tb[i].size(); l++){
            while(r < tb[i].size() && tb[i][r] < tb[i][l] + k) r++;
            ans = min(ans, a[i] * (k - r + l));
        }
    }
    cout << ans << '\n';
}
0