結果

問題 No.1430 Coup de Coupon
ユーザー t98slider
提出日時 2023-03-30 22:20:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 177,948 KB
実行使用メモリ 101,376 KB
最終ジャッジ日時 2024-09-22 07:20:12
合計ジャッジ時間 6,827 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 20
権限があれば一括ダウンロードができます

ソースコード

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<int> p(n);
    vector<vector<int>> 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<int>> dp(n + 1, vector<int>(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[j + 1][k] = min(dp[j + 1][k], dp[j][k] + max(0, p[i] - tb[0][j]));
            dp[j][k + 1] = min(dp[j][k + 1], dp[j][k] + p[i] * (100 - tb[1][k]) / 100);
        }
    }
    int ans = 1 << 30;
    for(int i = 0; i <= n; i++) ans = min(ans, dp[i][n - i]);
    cout << ans << '\n';
}
0