Submission #19723361


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,x};
    }
    sort(a.rbegin(),a.rend());
    int cnt = 0;
    for(auto &i : a){
        cnt++;
        L -= i.second;
        R += i.first;
        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 564 Byte
Status WA
Exec Time 131 ms
Memory 4776 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 7 ms 3472 KB
02_small.txt AC 2 ms 3412 KB
03_small.txt AC 2 ms 3536 KB
04_small.txt AC 4 ms 3468 KB
05_small.txt AC 2 ms 3536 KB
06_small.txt AC 2 ms 3416 KB
07_small.txt AC 3 ms 3512 KB
08_small.txt AC 2 ms 3408 KB
09_small.txt AC 2 ms 3616 KB
10_small.txt AC 2 ms 3588 KB
11_small.txt AC 3 ms 3608 KB
12_small.txt AC 2 ms 3452 KB
13_small.txt AC 2 ms 3540 KB
14_small.txt AC 2 ms 3476 KB
15_small.txt AC 2 ms 3404 KB
16_large.txt WA 69 ms 3876 KB
17_large.txt WA 123 ms 4476 KB
18_large.txt WA 46 ms 3612 KB
19_large.txt WA 42 ms 3540 KB
20_large.txt WA 51 ms 3680 KB
21_large.txt WA 42 ms 3612 KB
22_large.txt WA 33 ms 3580 KB
23_large.txt AC 5 ms 3584 KB
24_large.txt WA 105 ms 4500 KB
25_large.txt WA 129 ms 4776 KB
26_max.txt AC 100 ms 4708 KB
27_max.txt AC 97 ms 4648 KB
28_max.txt AC 131 ms 4732 KB
sample_01.txt AC 2 ms 3452 KB
sample_02.txt AC 4 ms 3456 KB
sample_03.txt AC 2 ms 3452 KB