結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
tko919
|
| 提出日時 | 2021-03-14 15:11:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,073 bytes |
| コンパイル時間 | 2,056 ms |
| コンパイル使用メモリ | 202,432 KB |
| 最終ジャッジ日時 | 2025-01-19 16:52:52 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 20 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end
ll dp[5010][5010];
int main(){
int n,m;
cin>>n>>m;
vector<int> p(n);
rep(i,0,n)cin>>p[i];
sort(ALL(p),greater<int>());
vector<int> cs[2];
rep(i,0,m){
int t,x;
cin>>t>>x; t--;
cs[t].push_back(x);
}
rep(i,0,2){
sort(ALL(cs[i]));
cs[i].resize(n+1);
}
rep(i,0,n+1)rep(j,0,n+1)dp[i][j]=INF;
dp[0][0]=0;
rep(i,0,n)rep(j,0,i+1)if(dp[i][j]!=INF){
chmin(dp[i+1][j],dp[i][j]+max(0,p[i]-cs[0][i-j]));
chmin(dp[i+1][j+1],dp[i][j]+p[i]/100*(100-cs[1][j]));
}
ll res=INF;
rep(i,0,n+1)chmin(res,dp[n][i]);
cout<<res<<'\n';
return 0;
}
tko919