結果

問題 No.1570 Blocks
ユーザー もなもな
提出日時 2021-06-27 13:39:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,232 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 205,240 KB
実行使用メモリ 5,312 KB
最終ジャッジ日時 2023-09-07 17:39:52
合計ジャッジ時間 4,935 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 24 ms
5,096 KB
testcase_03 AC 27 ms
5,084 KB
testcase_04 AC 20 ms
4,376 KB
testcase_05 AC 21 ms
4,380 KB
testcase_06 AC 20 ms
4,380 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 26 ms
5,100 KB
testcase_09 AC 30 ms
5,100 KB
testcase_10 AC 26 ms
5,220 KB
testcase_11 AC 28 ms
5,084 KB
testcase_12 AC 30 ms
5,232 KB
testcase_13 AC 33 ms
5,104 KB
testcase_14 AC 34 ms
5,216 KB
testcase_15 AC 16 ms
4,380 KB
testcase_16 AC 33 ms
5,212 KB
testcase_17 AC 14 ms
4,376 KB
testcase_18 AC 28 ms
5,312 KB
testcase_19 AC 14 ms
4,376 KB
testcase_20 AC 15 ms
4,380 KB
testcase_21 AC 23 ms
5,148 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 30 ms
5,104 KB
testcase_33 AC 31 ms
5,180 KB
testcase_34 AC 31 ms
5,112 KB
testcase_35 AC 30 ms
5,100 KB
testcase_36 AC 33 ms
5,112 KB
testcase_37 AC 29 ms
5,212 KB
testcase_38 WA -
testcase_39 AC 33 ms
5,220 KB
testcase_40 AC 32 ms
5,168 KB
testcase_41 AC 30 ms
5,164 KB
testcase_42 AC 34 ms
5,088 KB
testcase_43 AC 34 ms
5,084 KB
testcase_44 AC 35 ms
5,220 KB
testcase_45 AC 34 ms
5,088 KB
testcase_46 AC 31 ms
5,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define reps(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repit(i,C) for (auto i = (C).begin(); i != (C).end(); i++)
#define pr(a) cout << a
#define prl(a) cout << (a) << endl
#define prld(a) cout << setprecision(15)<< (a) << endl 
#define allrange(a) a.begin(),a.end()

int solve(){
    return 0;
}

int main(){
    std::cin.tie(0); // cinとcoutの同期を解除
    std::ios::sync_with_stdio(false);
    int N;cin >> N;
//  int N,M;cin >> N>>M;
//  int N,M,K;cin >> N>>M>>K;

    
    vector<pair<int64_t,int64_t>> B;
    int64_t tot=0;
    rep(i,N) {
        int64_t a;int64_t b;
        cin >> a>> b;
        tot += a;
        B.push_back(make_pair(b,a));
    }
    
    sort(allrange(B));
    int64_t ntot = 0;
    bool flg=true;
    
    bool uselast = false;
    repit(itr,B){
        if(ntot>itr->first) 
        {
            if((tot-(itr->second))<=itr->first){
                continue;
            }
            flg=false; break;
        } 
        ntot += itr->second;
    }
    

//    if(flg) prl(ans); else prl(-1);
    if(flg) prl("Yes"); else prl("No");
}
0