結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-18 10:24:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,819 bytes |
| コンパイル時間 | 2,013 ms |
| コンパイル使用メモリ | 205,392 KB |
| 最終ジャッジ日時 | 2025-01-23 03:08:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 WA * 9 |
ソースコード
#include<bits/stdc++.h>
#include <atcoder/twosat>
using namespace std;
using namespace atcoder;
using ll = long long int;
using ld = long double;
const ll MAX = 5000000000000000000;
const ld PI = 3.14159265358979;
const ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
ll N,X,Y,Z;
cin >> N >> X >> Y >> Z;
vector<ll> A(N);
for(ll i = 0;i < N;i++){
ll a;
cin >> a;
A[i] = (a / 1000) * 1000 + 1000;
}
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
ll p = A[i] / 10000;
p = min(p,Z);
Z -= p;
A[i] -= 10000 * p;
}
if(Z != 0){
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
if(Z != 0){
A[i] = 0;
Z--;
}
}
}
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
ll p = A[i] / 5000;
p = min(p,Y);
Y -= p;
A[i] -= 5000 * p;
}
if(Y != 0){
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
if(Y != 0){
A[i] = 0;
Y--;
}
}
}
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
ll p = A[i] / 1000;
p = min(p,X);
Y -= p;
A[i] -= 1000 * p;
}
if(X != 0){
sort(A.begin(),A.end(),greater<ll>());
for(ll i = 0;i < N;i++){
if(X != 0){
A[i] = 0;
X--;
}
}
}
ll a = 0;
for(ll i = 0;i < N;i++) a += A[i];
if(a == 0) cout << "Yes" << endl;
else cout << "No" << endl;
}