結果
| 問題 |
No.1570 Blocks
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-27 14:19:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| コード長 | 371 bytes |
| コンパイル時間 | 2,419 ms |
| コンパイル使用メモリ | 197,796 KB |
| 最終ジャッジ日時 | 2025-01-22 14:16:49 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 45 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct block{int w,s;};
signed main(){
int N;cin>>N;
vector<block>B(N);
for(int i=0;i<N;i++)cin>>B[i].w>>B[i].s;
sort(B.begin(),B.end(),[](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");
}