# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893358 | vjudge1 | Event Hopping 2 (JOI21_event2) | C++17 | 25 ms | 6960 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define endl "\n"
#define ll long long
#define int ll
int E,B;
void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
const ll N=5e5+5,INF=1e18,mod=1e9+7;
void solve(){
int n,k;cin>>n>>k;
vector<pair<pair<int,int>,int>> vec;
for(int i=0;i<n;i++){
int a,b;cin>>a>>b;vec.pb({{b,a},i});
}
sort(all(vec));
int cur=0,ans=0;
vector<int> res;
for(auto it: vec){
if(it.fr.sc>=cur){
cur=it.fr.fr;
res.pb(it.sc);
ans++;
}
}
if(k>(int)res.size()) cout<<-1;
else{
sort(all(res));
for(int i=0;i<k;i++) cout<<res[i]+1<<endl;
}
//cout<<ans;
}
main(){
B=clock();
ios;
int T=1;
//cin>>T;
for(int i=1;i<=T;i++){
//cout<<"Case #"<<i<<": ";
solve();
}
E=clock();
cerr<<"\n\n\n\nTIME: "<<((float)E-B)/CLOCKS_PER_SEC<<" SECONDS";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |