結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
sugarrr
|
| 提出日時 | 2020-04-03 22:10:08 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,169 bytes |
| コンパイル時間 | 2,125 ms |
| コンパイル使用メモリ | 163,780 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 17:18:20 |
| 合計ジャッジ時間 | 3,790 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
bool comp(ll i,ll j){
return i%5<j%5;
}
bool comp1(ll i,ll j){
return i%10<j%!0;
}
int main(){fastio
ll n,x,y,z;cin>>n>>x>>y>>z;
ll a[n];rep(i,0,n-1)cin>>a[i];
ll c[n];
rep(i,0,n-1){
c[i]=(a[i])/1000+1;
}
sort(c,c+n,comp);
for(ll i=0;i<n && x>0;i++){
if(c[i]%5==0)continue;
if(c[i]%5<=x){
x-=c[i]%5;
c[i]-=c[i]%5;
}else{
break;
}
}
if(x>0){
y+=x/5;
for(ll i=0;i<n && y>0;i++){
if(c[i]%10==5){
y-=1;
c[i]-=5;
}
}
z+=y/2;
ll sum=0;
rep(i,0,n-1){
sum+=(c[i]+9)/10;
}
if(sum>z){
cout<<"No"<<endl;
return 0;
}else{
cout<<"Yes"<<endl;
}
}else{
rep(i,0,n-1){
if(c[i]%5!=0){
c[i]+=(5-c[i]%5);
}
}
for(ll i=0;i<n && y>0;i++){
if(c[i]%10==5){
y-=1;
c[i]-=5;
}
}
z+=y/2;
ll sum=0;
rep(i,0,n-1){
sum+=(c[i]+9)/10;
}
if(sum>z){
cout<<"No"<<endl;
return 0;
}else{
cout<<"Yes"<<endl;
}
}
return 0;
}
sugarrr