結果

問題 No.1430 Coup de Coupon
ユーザー t98slidert98slider
提出日時 2023-03-30 22:55:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 906 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 176,596 KB
実行使用メモリ 101,204 KB
最終ジャッジ日時 2023-10-22 06:28:07
合計ジャッジ時間 4,937 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 105 ms
101,168 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 107 ms
101,168 KB
testcase_07 AC 107 ms
101,168 KB
testcase_08 AC 105 ms
101,168 KB
testcase_09 AC 109 ms
101,168 KB
testcase_10 AC 106 ms
101,168 KB
testcase_11 AC 107 ms
101,168 KB
testcase_12 AC 106 ms
101,168 KB
testcase_13 AC 106 ms
101,168 KB
testcase_14 AC 106 ms
101,168 KB
testcase_15 AC 106 ms
101,168 KB
testcase_16 AC 107 ms
101,168 KB
testcase_17 AC 107 ms
101,168 KB
testcase_18 WA -
testcase_19 AC 105 ms
101,168 KB
testcase_20 RE -
testcase_21 AC 18 ms
19,328 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 RE -
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 10 ms
11,144 KB
testcase_26 AC 7 ms
7,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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, vector<int>(n));
    for(auto &&v : p) cin >> v;
    for(int i = 0, j = 0, k = 0; i < c; i++){
        cin >> t >> x;
        tb[--t][t ? j++ : k++] = x;
    }
    sort(tb[0].rbegin(), tb[0].rend());
    sort(tb[1].rbegin(), tb[1].rend());
    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[i + 1][j] = min(dp[i + 1][j], dp[i][j] + p[i] / 100 * (100 - tb[1][k]));
            dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + max(0, p[i] - tb[0][j]));
        }
    }
    cout << *min_element(dp[n].begin(), dp[n].end()) << '\n';
}
0