結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-14 14:28:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,476 bytes |
| コンパイル時間 | 4,540 ms |
| コンパイル使用メモリ | 248,116 KB |
| 実行使用メモリ | 814,668 KB |
| 最終ジャッジ日時 | 2024-11-06 04:12:39 |
| 合計ジャッジ時間 | 6,897 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 2 MLE * 1 -- * 20 |
ソースコード
#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];
}
for (int i = 0; i < min(0, N - C); 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;
}