結果

問題 No.1570 Blocks
ユーザー ytftytft
提出日時 2021-12-30 16:45:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 174,088 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 01:28:40
合計ジャッジ時間 4,005 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
5,376 KB
testcase_34 WA -
testcase_35 AC 2 ms
5,376 KB
testcase_36 WA -
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
5,376 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:47: warning: 'N' is used uninitialized [-Wuninitialized]
    7 |     vector<vector<int>> block(N,vector<int>(2));
      |                                               ^
main.cpp:5:9: note: 'N' was declared here
    5 |     int N,cur=0;
      |         ^

ソースコード

diff #

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

int main(){
    int N,cur=0;
    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