結果

問題 No.1015 おつりは要らないです
ユーザー le_panda_noirle_panda_noir
提出日時 2020-06-14 17:55:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,249 bytes
コンパイル時間 975 ms
コンパイル使用メモリ 98,496 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 22:26:36
合計ジャッジ時間 3,871 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 37 ms
4,384 KB
testcase_16 AC 38 ms
4,380 KB
testcase_17 AC 39 ms
4,380 KB
testcase_18 AC 37 ms
4,384 KB
testcase_19 AC 37 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 19 ms
4,380 KB
testcase_32 AC 19 ms
4,384 KB
testcase_33 AC 41 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

int main() {
  int N, X, Y, Z;
  ins(N, X, Y, Z);

  priority_queue<int> q;
  rep(i, N) {
    int A; cin >> A;
    q.push(A);
  }
  while (!q.empty() && Z > 0) {
    int p = q.top(); q.pop();
    if (p >= 10000) {
      if (Z * 10000 > p) {
        Z -= p / 10000;
        p -= p / 10000 * 10000;
        continue;
      }
      p -= Z * 10000;
      Z = 0;
      q.push(p);
      continue;
    }
    --Z;
  }
  while (!q.empty() && Y > 0) {
    int p = q.top(); q.pop();
    if (p >= 5000) {
      if (Y * 5000 > p) {
        Y -= p / 5000;
        p -= p / 5000 * 5000;
        continue;
      }
      p -= Y * 5000;
      Y = 0;
      q.push(p);
      continue;
    }
    --Y;
  }
  while (!q.empty() && X > 0) {
    int p = q.top(); q.pop();
    X -= ceil((p + (p % 1000)) / 1000.0);
  }
  if (!q.empty()) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";

  return 0;
}
0