Submission #6831836


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;

#define int long long 

signed main()
{
    int n,m;
    cin >> n >> m;

    priority_queue<pair<int,int>> pq;
    for(int i = 0; i < n; ++i)
    {
        pair<int,int> p;
        cin >> p.second >> p.first;
        pq.push(p);
    }
    
 
    int ans = 0;

   
    for(int i = m; i >= 1; --i)
    {
        
        while(!pq.empty() && pq.top().second > i)
        {
            pq.pop();
        }
       
        if(!pq.empty())
        {
            ans += pq.top().first;
            pq.pop();
        }
        // cout << ans << " ";
    }
    cout << ans;
}

Submission Info

Submission Time
Task D - Summer Vacation
User medhruv7
Language C++14 (GCC 5.4.1)
Score 0
Code Size 651 Byte
Status WA
Exec Time 69 ms
Memory 2420 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 10 ms 640 KB
testcase_02 WA 3 ms 384 KB
testcase_03 WA 54 ms 2420 KB
testcase_04 WA 68 ms 2420 KB
testcase_05 WA 68 ms 2420 KB
testcase_06 AC 67 ms 2420 KB
testcase_07 WA 68 ms 2420 KB
testcase_08 WA 17 ms 892 KB
testcase_09 WA 39 ms 2420 KB
testcase_10 WA 56 ms 2420 KB
testcase_11 WA 61 ms 2420 KB
testcase_12 WA 18 ms 892 KB
testcase_13 WA 69 ms 2420 KB
testcase_14 WA 63 ms 2420 KB
testcase_15 AC 6 ms 512 KB
testcase_16 WA 69 ms 2420 KB
testcase_17 WA 9 ms 640 KB
testcase_18 WA 57 ms 2420 KB