Submission #19723302


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 571 Byte
Status WA
Exec Time 135 ms
Memory 4776 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
WA × 1
AC × 21
WA × 10
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 8 ms 3532 KB
02_small.txt AC 2 ms 3580 KB
03_small.txt AC 3 ms 3460 KB
04_small.txt AC 2 ms 3464 KB
05_small.txt AC 4 ms 3580 KB
06_small.txt AC 2 ms 3504 KB
07_small.txt AC 2 ms 3504 KB
08_small.txt AC 4 ms 3460 KB
09_small.txt AC 2 ms 3612 KB
10_small.txt AC 3 ms 3396 KB
11_small.txt AC 3 ms 3452 KB
12_small.txt AC 2 ms 3536 KB
13_small.txt AC 3 ms 3396 KB
14_small.txt AC 2 ms 3532 KB
15_small.txt AC 2 ms 3464 KB
16_large.txt WA 69 ms 3800 KB
17_large.txt WA 123 ms 4440 KB
18_large.txt WA 47 ms 3604 KB
19_large.txt WA 44 ms 3588 KB
20_large.txt WA 50 ms 3712 KB
21_large.txt WA 42 ms 3460 KB
22_large.txt WA 39 ms 3464 KB
23_large.txt AC 11 ms 3612 KB
24_large.txt WA 106 ms 4436 KB
25_large.txt WA 135 ms 4776 KB
26_max.txt AC 100 ms 4664 KB
27_max.txt AC 97 ms 4604 KB
28_max.txt AC 133 ms 4604 KB
sample_01.txt AC 3 ms 3600 KB
sample_02.txt WA 2 ms 3396 KB
sample_03.txt AC 3 ms 3444 KB