Contest Duration: - (local time) (100 minutes) Back to Home

Submission #6811455

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n,m,ans=0;
cin>>n>>m;
vl a(n),b(n);
rep(i,n)cin>>a[i]>>b[i];
vvl vm(100002);
rep(i,n){
vm[a[i]-1].push_back(b[i]);
}
priority_queue<ll> q;
rep(i,m){
for(auto x:vm[i]){
q.push(x);
}
if(q.empty())continue;
ans+=q.top();q.pop();
}
cout<<ans<<endl;
}
```

#### Submission Info

Submission Time 2019-08-10 21:16:44+0900 D - Summer Vacation makecir C++14 (GCC 5.4.1) 400 2166 Byte AC 30 ms 7296 KB

#### Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
 AC × 21
 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 2 ms 2560 KB
sample_02 AC 2 ms 2560 KB
sample_03 AC 2 ms 2560 KB
testcase_01 AC 6 ms 3200 KB
testcase_02 AC 3 ms 2816 KB
testcase_03 AC 21 ms 5632 KB
testcase_04 AC 30 ms 6272 KB
testcase_05 AC 30 ms 6272 KB
testcase_06 AC 24 ms 6016 KB
testcase_07 AC 26 ms 7296 KB
testcase_08 AC 10 ms 3840 KB
testcase_09 AC 20 ms 5496 KB
testcase_10 AC 28 ms 6392 KB
testcase_11 AC 23 ms 6128 KB
testcase_12 AC 8 ms 3712 KB
testcase_13 AC 26 ms 6256 KB
testcase_14 AC 19 ms 6132 KB
testcase_15 AC 4 ms 2944 KB
testcase_16 AC 21 ms 6116 KB
testcase_17 AC 6 ms 3328 KB
testcase_18 AC 29 ms 6520 KB