結果

問題 No.1430 Coup de Coupon
ユーザー gorugo30gorugo30
提出日時 2021-03-14 14:31:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,491 bytes
コンパイル時間 4,789 ms
コンパイル使用メモリ 242,224 KB
実行使用メモリ 814,764 KB
最終ジャッジ日時 2024-04-23 21:59:26
合計ジャッジ時間 7,068 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define MOD 1000000007
#define MOD9 998244353
#define pb push_back
#define yes "Yes"
#define no "No"
#define takah "Takahashi"
#define aoki "Aoki"
#define ALL(x) (x).begin(), (x).end()
template<class T> bool chmax(T &x, const T &y){if (x < y) {x = y; return true;} return false;}
template<class T> bool chmin(T &x, const T &y){if (x > y) {x = y; return true;} return false;}
template<class T> void print(T x){cout << x << endl;}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N, C;
    cin >> N >> C;
    vector<int> P(N);
    for (int i = 0; i < N; i++) cin >> P[i];
    vector<vector<int>> Cs(C, vector<int>(2));
    for (int i = 0; i < C; i++){
        cin >> Cs[i][0] >> Cs[i][1];
    }
    int d = N - C;
    for (int i = 0; i < max(0, d); i++){
        Cs.pb({1, 0});
        C++;
    }
    mcf_graph<int, int> graph(N + C + 2);
    int S = N + C;
    int T = N + C + 1;
    for (int i = 0; i < N; i++){
        graph.add_edge(S, i, 1, 0);
        for (int j = 0; j < C; j++){
            int price;
            if (Cs[j][0] == 1){
                price = max(P[i] - Cs[j][1], 0);
            } else {
                price = P[i] * (100 - Cs[j][1]) / 100;
            }
            graph.add_edge(i, j + N, 1, price);
        }
    }
    for (int j = 0; j < C; j++){
        graph.add_edge(j + N, T, 1, 0);
    }
    cout << graph.flow(S, T).second << endl;
}
0