結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 27 ms
6,420 KB
testcase_03 AC 26 ms
5,188 KB
testcase_04 AC 23 ms
5,616 KB
testcase_05 AC 24 ms
5,740 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 26 ms
5,084 KB
testcase_09 AC 29 ms
5,064 KB
testcase_10 AC 30 ms
7,184 KB
testcase_11 AC 33 ms
7,512 KB
testcase_12 AC 30 ms
5,092 KB
testcase_13 AC 38 ms
7,548 KB
testcase_14 AC 39 ms
7,808 KB
testcase_15 AC 18 ms
5,140 KB
testcase_16 AC 38 ms
7,504 KB
testcase_17 AC 14 ms
4,384 KB
testcase_18 AC 32 ms
7,164 KB
testcase_19 AC 14 ms
4,380 KB
testcase_20 AC 18 ms
5,212 KB
testcase_21 AC 23 ms
5,140 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,384 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 30 ms
5,152 KB
testcase_33 AC 30 ms
5,096 KB
testcase_34 AC 36 ms
7,548 KB
testcase_35 AC 29 ms
5,156 KB
testcase_36 AC 37 ms
7,448 KB
testcase_37 AC 28 ms
5,212 KB
testcase_38 WA -
testcase_39 AC 38 ms
7,776 KB
testcase_40 AC 37 ms
7,512 KB
testcase_41 AC 30 ms
5,208 KB
testcase_42 AC 39 ms
7,768 KB
testcase_43 AC 39 ms
7,792 KB
testcase_44 AC 39 ms
7,776 KB
testcase_45 AC 39 ms
7,712 KB
testcase_46 AC 31 ms
5,208 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;
    
    int64_t before_a=0;
    int64_t before_b=0;
    vector<pair<int64_t,int64_t>> C;
    while(true){
      C=vector<pair<int64_t,int64_t>>(0);
      repit(itr,B){
        if(ntot>itr->first){
            if(ntot-before_a <= itr->first){
                ntot -= before_a;
                C.push_back(make_pair(before_b,before_a));
            }
            else {flg=false; break;}
        }
        ntot += itr->second;
        before_a = itr->second;
        before_b = itr->first;
      }
      if(C.empty()) break;
      if(C.size()==B.size()) {flg=false; break;}
      sort(allrange(C));
      B=C;
    }
    

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