結果

問題 No.1570 Blocks
ユーザー umezoumezo
提出日時 2021-06-27 13:27:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 2,266 ms
コンパイル使用メモリ 206,640 KB
実行使用メモリ 6,472 KB
最終ジャッジ日時 2023-09-07 17:37:17
合計ジャッジ時間 5,219 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 23 ms
5,104 KB
testcase_03 WA -
testcase_04 AC 21 ms
4,892 KB
testcase_05 AC 22 ms
4,840 KB
testcase_06 WA -
testcase_07 AC 5 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 27 ms
5,376 KB
testcase_11 AC 29 ms
5,636 KB
testcase_12 WA -
testcase_13 AC 33 ms
5,892 KB
testcase_14 AC 34 ms
6,284 KB
testcase_15 AC 16 ms
4,380 KB
testcase_16 AC 34 ms
5,900 KB
testcase_17 WA -
testcase_18 AC 28 ms
5,480 KB
testcase_19 WA -
testcase_20 AC 15 ms
4,412 KB
testcase_21 WA -
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 32 ms
6,016 KB
testcase_33 WA -
testcase_34 AC 32 ms
5,948 KB
testcase_35 WA -
testcase_36 AC 33 ms
5,908 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 34 ms
6,160 KB
testcase_40 AC 33 ms
6,016 KB
testcase_41 WA -
testcase_42 AC 35 ms
6,156 KB
testcase_43 AC 35 ms
6,208 KB
testcase_44 AC 35 ms
6,272 KB
testcase_45 AC 35 ms
6,252 KB
testcase_46 AC 34 ms
6,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  vector<ll> A(n),B(n);
  rep(i,n) cin>>A[i]>>B[i];
  
  vector<pair<ll,ll>> C(n+1);
  rep(i,n) C[i+1]={A[i],B[i]};
  C[0]={0,0};
  sort(ALL(C));
  
  bool b=true;
  ll sum=0;
  for(int i=0;i<=n;i++){
    if(sum>C[i].second) b=false;
    sum+=C[i].first;
  }
  if(b) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    
  return 0;
}
0