結果

問題 No.1430 Coup de Coupon
ユーザー eQeeQe
提出日時 2021-03-21 14:28:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,414 bytes
コンパイル時間 3,867 ms
コンパイル使用メモリ 238,016 KB
実行使用メモリ 199,168 KB
最終ジャッジ日時 2024-05-01 23:18:47
合計ジャッジ時間 7,911 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 182 ms
198,912 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 186 ms
198,912 KB
testcase_07 AC 181 ms
198,912 KB
testcase_08 AC 180 ms
198,912 KB
testcase_09 AC 184 ms
198,912 KB
testcase_10 AC 190 ms
199,040 KB
testcase_11 AC 187 ms
199,040 KB
testcase_12 AC 188 ms
199,040 KB
testcase_13 AC 191 ms
198,912 KB
testcase_14 AC 187 ms
198,912 KB
testcase_15 AC 189 ms
199,040 KB
testcase_16 AC 183 ms
199,040 KB
testcase_17 AC 183 ms
198,912 KB
testcase_18 AC 182 ms
199,168 KB
testcase_19 AC 181 ms
198,912 KB
testcase_20 AC 51 ms
53,632 KB
testcase_21 AC 30 ms
35,456 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 17 ms
18,944 KB
testcase_26 AC 9 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define itr(x,c) for(auto x=c.begin();x!=c.end();x++)
#define ritr(x,c) for(auto x=c.rbegin();x!=c.rend();x++)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define __builtin_popcount(v) popcount(v)
using namespace std;
#include <atcoder/all>
using namespace atcoder;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
//static const ll MOD=998244353;
//for(i=0;i<N;i++) cin>>a[i];

typedef vector<ll> v1d;
typedef vector<v1d> v2d;
typedef vector<v2d> v3d;
typedef vector<v3d> v4d;


int main(void) {
  ll i,j,k,l;
  
  ll N,C;cin>>N>>C;
  v1d p(N),a,b;
  
  for(i=0;i<N;i++) cin>>p[i];
  for(i=0;i<C;i++){
    ll t,x;cin>>t>>x;
    
    if(t==1) a.push_back(x);
    else b.push_back(x);
  }
  
  while(ll(a.size())<N) a.push_back(0);
  while(ll(b.size())<N) b.push_back(0);
  
  sort(rall(p));sort(rall(a));sort(rall(b));
  
  v2d dp(N+1,v1d(N+1,INF));
  
  dp[0][0]=0;
  for(i=0;i<N;i++){
    for(j=0;j<=i;j++){
      chmin(dp[i+1][j+1],dp[i][j]+max(p[i]-a[j],0LL));
      chmin(dp[i+1][j],dp[i][j]+p[i]*(100-b[i-j])/100);
    }
  }
  
  
  pt(*min_element(all(dp[N])));
  
}
0