結果

問題 No.2549 Paint Eggs
ユーザー ルクルク
提出日時 2024-03-29 11:21:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 1,115 bytes
コンパイル時間 2,285 ms
コンパイル使用メモリ 205,236 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-03-29 11:21:53
合計ジャッジ時間 9,236 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 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 3 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 116 ms
7,168 KB
testcase_11 AC 110 ms
7,040 KB
testcase_12 AC 86 ms
6,676 KB
testcase_13 AC 109 ms
6,912 KB
testcase_14 AC 80 ms
6,676 KB
testcase_15 AC 9 ms
6,676 KB
testcase_16 AC 102 ms
6,676 KB
testcase_17 AC 70 ms
6,676 KB
testcase_18 AC 60 ms
6,676 KB
testcase_19 AC 82 ms
6,676 KB
testcase_20 AC 142 ms
8,064 KB
testcase_21 AC 142 ms
8,064 KB
testcase_22 AC 145 ms
8,064 KB
testcase_23 AC 142 ms
8,064 KB
testcase_24 AC 142 ms
8,064 KB
testcase_25 AC 141 ms
8,064 KB
testcase_26 AC 142 ms
8,064 KB
testcase_27 AC 142 ms
8,064 KB
testcase_28 AC 143 ms
8,064 KB
testcase_29 AC 142 ms
8,064 KB
testcase_30 AC 146 ms
8,064 KB
testcase_31 AC 143 ms
8,064 KB
testcase_32 AC 144 ms
8,064 KB
testcase_33 AC 143 ms
8,064 KB
testcase_34 AC 142 ms
8,064 KB
testcase_35 AC 142 ms
8,064 KB
testcase_36 AC 142 ms
8,064 KB
testcase_37 AC 145 ms
8,064 KB
testcase_38 AC 143 ms
8,064 KB
testcase_39 AC 143 ms
8,064 KB
testcase_40 AC 142 ms
8,064 KB
testcase_41 AC 142 ms
8,064 KB
testcase_42 AC 143 ms
8,064 KB
testcase_43 AC 144 ms
8,064 KB
testcase_44 AC 142 ms
8,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = n; i > 0; --i)
#define bitrep(i, n) for (ll i = 0; i < (1 << n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define yesNo(b) ((b) ? "Yes" : "No")
using ll = long long;
using ull = unsigned long long;
using ld = long double;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const double pi = 3.141592653589793;
ll smallMOD = 998244353;
ll bigMOD = 1000000007;

int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> C(n), A(m);
    rep(i, n) cin >> C[i], C[i]--;
    rep(i, m) cin >> A[i];
    vector<ll> cost(m, 0);
    rep(i, m)
    {
        cost[i] = A[i] * k;
    }
    rep(i, k)
    {
        cost[C[i]] -= A[C[i]];
    }
    ll mn = *min_element(all(cost));
    rep(i, n - k)
    {
        cost[C[i]] += A[C[i]];
        cost[C[i + k]] -= A[C[i + k]];
        mn = min(mn, cost[C[i + k]]);
    }
    cout << mn << endl;
    return 0;
}
0