結果

問題 No.1430 Coup de Coupon
ユーザー t98slidert98slider
提出日時 2023-03-30 22:24:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 179,096 KB
実行使用メモリ 198,868 KB
最終ジャッジ日時 2023-10-22 06:06:06
合計ジャッジ時間 5,718 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 185 ms
198,868 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 185 ms
198,868 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, c, t, x;
    cin >> n >> c;
    vector<ll> p(n);
    vector<vector<ll>> tb(2);
    tb[0].reserve(n);
    tb[1].reserve(n);
    for(auto &&v : p) cin >> v;
    for(int i = 0; i < c; i++){
        cin >> t >> x;
        tb[--t].emplace_back(x);
    }
    for(int i = 0; i < 2; i++){
        while(tb[i].size() < n) tb[i].emplace_back(0);
    }
    sort(p.rbegin(), p.rend());
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 1 << 30));
    dp[0][0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= i; j++){
            int k = i - j;
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + p[i] * (100 - tb[1][k]) / 100);
            dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + max(0ll, p[i] - tb[0][j]));
        }
    }
    ll ans = 1ll << 60;
    for(int i = 0; i <= n; i++) ans = min(ans, dp[n][i]);
    cout << ans << '\n';
}
0