Submission #19723260


Source Code Expand

Copy
/*
    /\ In The Name Of Allah /\
    Author : Jawahiir Nabhan
*/
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

int main()
{
    int n; cin>>n;
    vector <pair <int, int>> a(n);
    ll L = 0,R = 0;
    for(int i = 0;i < n;i++){
        int x,y; cin>>x>>y;
        L += x;
        a[i] = {x,y};
    }
    sort(a.rbegin(),a.rend());
    int cnt = 0;
    for(auto &i : a){
        cnt++;
        L -= i.first;
        R += i.first + i.second;
        if(R > L) break;
    }
    cout<<cnt<<endl;
}

Submission Info

Submission Time
Task D - Choose Me
User Jawa
Language C++ (GCC 9.2.1)
Score 0
Code Size 570 Byte
Status WA
Exec Time 133 ms
Memory 4760 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 22
WA × 9
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01_small.txt, 02_small.txt, 03_small.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_small.txt, 10_small.txt, 11_small.txt, 12_small.txt, 13_small.txt, 14_small.txt, 15_small.txt, 16_large.txt, 17_large.txt, 18_large.txt, 19_large.txt, 20_large.txt, 21_large.txt, 22_large.txt, 23_large.txt, 24_large.txt, 25_large.txt, 26_max.txt, 27_max.txt, 28_max.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01_small.txt AC 9 ms 3604 KB
02_small.txt AC 3 ms 3428 KB
03_small.txt AC 2 ms 3496 KB
04_small.txt AC 3 ms 3448 KB
05_small.txt AC 4 ms 3604 KB
06_small.txt AC 2 ms 3560 KB
07_small.txt AC 4 ms 3532 KB
08_small.txt AC 7 ms 3504 KB
09_small.txt AC 2 ms 3560 KB
10_small.txt AC 1 ms 3476 KB
11_small.txt AC 2 ms 3432 KB
12_small.txt AC 2 ms 3600 KB
13_small.txt AC 2 ms 3580 KB
14_small.txt AC 2 ms 3560 KB
15_small.txt AC 2 ms 3608 KB
16_large.txt WA 74 ms 3880 KB
17_large.txt WA 123 ms 4460 KB
18_large.txt WA 47 ms 3636 KB
19_large.txt WA 46 ms 3796 KB
20_large.txt WA 50 ms 3632 KB
21_large.txt WA 41 ms 3424 KB
22_large.txt WA 33 ms 3476 KB
23_large.txt AC 6 ms 3456 KB
24_large.txt WA 109 ms 4380 KB
25_large.txt WA 132 ms 4760 KB
26_max.txt AC 98 ms 4752 KB
27_max.txt AC 100 ms 4620 KB
28_max.txt AC 133 ms 4620 KB
sample_01.txt AC 4 ms 3424 KB
sample_02.txt AC 2 ms 3500 KB
sample_03.txt AC 3 ms 3476 KB