結果

問題 No.1570 Blocks
ユーザー the-xin
提出日時 2021-06-27 14:19:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 69,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 11:35:21
合計ジャッジ時間 3,051 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 1e5+10;
LL a[N],b[N],len=0;
struct Node{
	int a,b;
	bool operator<(const Node &A)const{
		return a+b<A.a+A.b;
	}
}node[N];
int main(){
	int n;
	scanf("%d",&n);
	LL sum=0;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&node[i].a,&node[i].b);
	}
	sort(a+1,a+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;
}
0