結果
| 問題 |
No.1570 Blocks
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-27 14:19:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 353 bytes |
| コンパイル時間 | 1,863 ms |
| コンパイル使用メモリ | 195,888 KB |
| 最終ジャッジ日時 | 2025-01-22 14:16:36 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 RE * 35 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct block{int w,s;};
block B[1100];
signed main(){
int N;cin>>N;
for(int i=0;i<N;i++)cin>>B[i].w>>B[i].s;
sort(B,B+N,[](block a,block b){return a.w+a.s<b.w+b.s;});
int sum=0;
for(int i=0;i<N;i++){
if(sum>B[i].s)return puts("No"),0;
sum+=B[i].w;
}
puts("Yes");
}