結果
| 問題 |
No.1430 Coup de Coupon
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-03-14 15:45:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 863 bytes |
| コンパイル時間 | 2,159 ms |
| コンパイル使用メモリ | 201,400 KB |
| 最終ジャッジ日時 | 2025-01-19 17:01:00 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 16 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,c;
cin>>n>>c;
vector<int> P(n);
rep(i,n) cin>>P[i];
sort(ALL(P));
reverse(ALL(P));
priority_queue<int> q1,q2;
rep(i,c){
int t,x;
cin>>t>>x;
if(t==1) q1.push(x);
else q2.push(x);
}
int ans=0;
rep(i,n){
if(q1.size()>0 && q2.size()>0){
if(max(P[i]-q1.top(),0)<=P[i]/100*(100-q2.top())){
ans+=max(P[i]-q1.top(),0);
q1.pop();
}
else{
ans+=P[i]/100*(100-q2.top());
q2.pop();
}
}
else if(q1.size()>0){
ans+=max(P[i]-q1.top(),0);
q1.pop();
}
else if(q2.size()>0){
ans+=P[i]/100*(100-q2.top());
q2.pop();
}
else ans+=P[i];
}
cout<<ans<<endl;
return 0;
}
umezo