結果

問題 No.1015 おつりは要らないです
ユーザー ngtkanangtkana
提出日時 2020-04-03 21:49:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,003 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 205,548 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 08:39:29
合計ジャッジ時間 4,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
using real=long double;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<lint>unit={10000,5000,1000},m(3);
    for(lint i=2;i>=0;i--)std::cin>>m.at(i);
    std::vector<lint>a(n);
    for(lint&x:a)std::cin>>x;
    lint extra=0;
    for(lint&x:a)if(x%1000==0){
        extra++;
    }
    for(lint i=0;i<3;i++){
        for(lint j=0;j<n;j++){
            lint q=std::min(m.at(i),a.at(j)/unit.at(i));
            m.at(i)-=q;
            a.at(j)-=q*unit.at(i);
        }
        std::sort(a.rbegin(),a.rend());
        for(lint j=0;j<n;j++){
            if(!m.at(i))break;
            if(a.at(j)%1000==0&&a.at(j)<unit.at(i))extra--;
            m.at(i)--;
            a.at(j)=0;
        }
    }
    std::cout<<(!std::accumulate(a.begin(),a.end(),0ll)&&
        extra<=std::accumulate(m.begin(),m.end(),0ll)?"Yes":"No")<<'\n';
}
0