Submission #19723237


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);
    int 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 571 Byte
Status WA
Exec Time 126 ms
Memory 4828 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 19
WA × 12
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 3460 KB
02_small.txt AC 3 ms 3472 KB
03_small.txt AC 2 ms 3580 KB
04_small.txt AC 5 ms 3416 KB
05_small.txt AC 2 ms 3520 KB
06_small.txt AC 3 ms 3612 KB
07_small.txt AC 3 ms 3420 KB
08_small.txt AC 2 ms 3580 KB
09_small.txt AC 4 ms 3476 KB
10_small.txt AC 2 ms 3608 KB
11_small.txt AC 3 ms 3500 KB
12_small.txt AC 2 ms 3536 KB
13_small.txt AC 2 ms 3584 KB
14_small.txt AC 6 ms 3440 KB
15_small.txt AC 3 ms 3584 KB
16_large.txt WA 72 ms 3984 KB
17_large.txt WA 119 ms 4512 KB
18_large.txt WA 41 ms 3528 KB
19_large.txt WA 46 ms 3612 KB
20_large.txt WA 51 ms 3768 KB
21_large.txt WA 42 ms 3444 KB
22_large.txt WA 37 ms 3496 KB
23_large.txt WA 6 ms 3404 KB
24_large.txt WA 103 ms 4556 KB
25_large.txt WA 123 ms 4828 KB
26_max.txt WA 98 ms 4764 KB
27_max.txt AC 96 ms 4728 KB
28_max.txt WA 126 ms 4776 KB
sample_01.txt AC 4 ms 3492 KB
sample_02.txt AC 3 ms 3472 KB
sample_03.txt AC 2 ms 3384 KB