結果

問題 No.1570 Blocks
ユーザー ytft
提出日時 2021-12-30 16:46:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 1,846 ms
コンパイル使用メモリ 177,276 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-10-06 10:31:29
合計ジャッジ時間 9,379 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 29 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,cur=0;
    cin>>N;
    string ans="Yes";
    vector<vector<int>> block(N,vector<int>(2));
    for(int i=0;i<N;++i){
        for(int j=0;j<2;++j){
            cin>>block[i][j];
        }
    }
    sort(block.begin(),block.end(),[](vector<int> a,vector<int> b){
        return a[0]+a[1]<b[0]+b[1];
    });
    for(vector<int> v:block){
        if(v[0]<cur){
            ans="No";
        }
        cur+=v[1];
    }
    cout<<ans<<endl;
}
0