結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
IKyopro
|
| 提出日時 | 2020-04-03 23:09:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 878 bytes |
| コンパイル時間 | 2,892 ms |
| コンパイル使用メモリ | 194,632 KB |
| 最終ジャッジ日時 | 2025-01-09 13:39:20 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
vec<int> X(3);
cin >> N >> X[0] >> X[1] >> X[2];
vec<int> B = {1000,5000,10000};
vec<int> A(N);
bool ok = true;
for(int i=0;i<N;i++){
int a;
cin >> a;
for(int j=2;j>=0;j--){
if(B[j]>=a){
int n = min(a/B[j],X[j]);
a -= n*B[j];
X[j] -= n;
}
}
for(int j=0;j<3;j++) if(X[j]){
X[j]--;
a = -1;
break;
}
ok &= a==-1;
}
cerr << B[0] << " " << B[1] << " " << B[2] << "\n";
cout << (ok? "Yes\n":"No\n");
}
IKyopro