Submission #6812607


Source Code Expand

Copy
#include <vector>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <list>
#include <map>
#include <istream>
#include <bitset>
#include <sstream>
#include <unordered_map>
#include <stack>
#include <set>
#include <cmath>
#include <random>
#include <iostream>
#include <bitset>
#include <iomanip>
#include <queue>
#include <string>

#define int long long
#define endl "\n"
#define all(x) x.begin(),x.end()
#define rr return 0
#define xx first
#define yy second
#define pii pair<int,int>

using namespace std;

typedef long long ll;
typedef long double ld;

bool cmp(pii a, pii b){
    if(a.yy == b.yy){
        return a.xx > b.xx;
    }
    return a.yy > b.yy;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    m++;
    vector<pii> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i].xx >> a[i].yy;
    }
    sort(all(a), cmp);
    int d = 1;
    int ans = 0;
    for(int i = 0;i < n;i++){
        if((a[i].xx + d) <= m){
            ans += a[i].yy;
            d++;
        }
    }
    cout << ans;
    rr;
}

Submission Info

Submission Time
Task D - Summer Vacation
User DJachenko
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1165 Byte
Status
Exec Time 26 ms
Memory 1792 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 400 sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB
testcase_01 5 ms 512 KB
testcase_02 2 ms 256 KB
testcase_03 21 ms 1536 KB
testcase_04 26 ms 1792 KB
testcase_05 26 ms 1792 KB
testcase_06 26 ms 1792 KB
testcase_07 26 ms 1792 KB
testcase_08 8 ms 768 KB
testcase_09 16 ms 1280 KB
testcase_10 24 ms 1792 KB
testcase_11 23 ms 1664 KB
testcase_12 7 ms 640 KB
testcase_13 26 ms 1792 KB
testcase_14 24 ms 1664 KB
testcase_15 3 ms 384 KB
testcase_16 26 ms 1792 KB
testcase_17 4 ms 512 KB
testcase_18 25 ms 1792 KB