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 WA
Exec Time 26 ms
Memory 1792 KB

Judge Result

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