結果
問題 |
No.1570 Blocks
|
ユーザー |
|
提出日時 | 2021-06-27 14:31:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 496 bytes |
コンパイル時間 | 729 ms |
コンパイル使用メモリ | 70,668 KB |
実行使用メモリ | 7,088 KB |
最終ジャッジ日時 | 2024-06-25 11:39:24 |
合計ジャッジ時間 | 3,600 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 42 WA * 3 |
ソースコード
#include<iostream> #include<algorithm> #include<cstring> using namespace std; typedef long long LL; const int N = 1e6+10; struct Node{ LL a,b; bool operator<(const Node &A)const{ return b-a<A.b-A.a; } }node[N]; int main(){ int n; scanf("%d",&n); LL sum=0; for(int i=1;i<=n;i++){ scanf("%lld%lld",&node[i].a,&node[i].b); } sort(node+1,node+1+n); int flag=1; for(int i=1;i<=n;i++){ if(node[i].b<sum)flag=0; sum+=node[i].a; } if(flag)puts("Yes"); else puts("No"); return 0; }