Submission #6062994


Source Code Expand

Copy
#include <bits/stdc++.h>
#define int long long
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

signed main(){
    int n;
    cin >> n;
    vector<pii> v(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        v[i] = make_pair(b, a);
    }
    sort(all(v));
    int t = 0;
    rep(i, n) {
        // cout << t << " " << v[i].fi << " " << v[i].se << " " << t << endl;
        if(t + v[i].se > v[i].fi) {
            cout << "No" << endl;
            return 0;
        }
        t = t + v[i].se;
    }
    cout << "Yes" << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Megalomania
User T1610
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1071 Byte
Status AC
Exec Time 141 ms
Memory 3328 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 32
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sub1_01.txt AC 1 ms 256 KB
sub1_02.txt AC 141 ms 3328 KB
sub1_03.txt AC 47 ms 1408 KB
sub1_04.txt AC 127 ms 3328 KB
sub1_05.txt AC 1 ms 256 KB
sub1_06.txt AC 1 ms 256 KB
sub1_07.txt AC 118 ms 3328 KB
sub1_08.txt AC 118 ms 3328 KB
sub1_09.txt AC 1 ms 256 KB
sub1_10.txt AC 128 ms 3328 KB
sub1_11.txt AC 125 ms 3328 KB
sub1_12.txt AC 3 ms 256 KB
sub1_13.txt AC 3 ms 256 KB
sub1_14.txt AC 82 ms 2048 KB
sub1_15.txt AC 21 ms 640 KB
sub1_16.txt AC 139 ms 3328 KB
sub1_17.txt AC 16 ms 640 KB
sub1_18.txt AC 16 ms 640 KB
sub1_19.txt AC 4 ms 384 KB
sub1_20.txt AC 131 ms 3328 KB
sub1_21.txt AC 130 ms 3328 KB
sub1_22.txt AC 137 ms 3328 KB
sub1_23.txt AC 26 ms 896 KB
sub1_24.txt AC 1 ms 256 KB
sub1_25.txt AC 1 ms 256 KB
sub1_26.txt AC 1 ms 256 KB
sub1_27.txt AC 3 ms 256 KB
sub1_28.txt AC 122 ms 3328 KB
sub1_29.txt AC 123 ms 3328 KB