Submission #893525

#TimeUsernameProblemLanguageResultExecution timeMemory
893525vjudge1Event Hopping 2 (JOI21_event2)C++17
0 / 100
22 ms3288 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define int long long #define pb push_back #define ff first #define ss second #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> using namespace std; using namespace __gnu_pbds; const int mod = 998244353; const double PI = acos(-1.0); const double epsilon = 1e-6; void solve(){ int n,k; cin >> n >> k; pair<int,int> a[n+1]; for(int i = 1; i <= n; i++){ int l, r; cin >> l >> r; a[i] = {r, l}; } sort(a + 1, a + 1 + n); int last = 0; vector<int> ans; for(int i = 1; i <= n; i++){ int l = a[i].ss; int r = a[i].ff; if(last <= l){ last = r; ans.pb(i); } } if((int)ans.size() < k){ cout << "-1\n"; return; } for(int i = 0; i < k; i++) cout << ans[i] << '\n'; } main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tt = 1; //cin >> tt; while (tt--) { solve(); } }

Compilation message (stderr)

event2.cpp:48:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   48 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...