217662026-01-13 20:22:12TaxiradioTanúk (45 pont)cpp17Elfogadva 45/45134ms3624 KiB
// Source: https://usaco.guide/general/io

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

#define int int64_t

int32_t main() {
    int n , h , k;cin >> n >> h >> k;
    vector<int> a;
    for(int i = 0; i < k; i++){
        int x;cin >> x;
        a.push_back(x);
    }
    vector<array<int , 2>> o(h+1 , {-1 , -1});
    sort(a.begin() , a.end());
    vector<array<int , 2>> b;
    for(int i = 0; i < n; i++){
        int l , r; cin >> l >> r;
        if(lower_bound(a.begin() , a.end() , l) == upper_bound(a.begin() , a.end() , r))continue;
        b.push_back({r , l});
        array<int , 2> z = {r , i+1};
        o[l] = max(z , o[l]);
    }
    for(int i = 1; i <= h; i++){
        o[i] = max(o[i] , o[i-1]);
    }
    sort(b.begin() , b.end());
    int u = -1;
    vector<int> ans;
    for(int i = 0; i < b.size(); i++){
        if(u < b[i][1]){
            ans.push_back(o[b[i][0]][1]);
            u = o[b[i][0]][0];
        }
    }
    cout << ans.size() << endl;
    for(int x : ans)cout << x << " ";
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base45/45
1Elfogadva0/01ms316 KiB
2Elfogadva0/041ms1708 KiB
3Elfogadva2/232ms1268 KiB
4Elfogadva2/21ms564 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms564 KiB
7Elfogadva2/22ms564 KiB
8Elfogadva2/22ms564 KiB
9Elfogadva2/23ms1116 KiB
10Elfogadva2/22ms564 KiB
11Elfogadva2/24ms1076 KiB
12Elfogadva2/26ms1116 KiB
13Elfogadva2/27ms1168 KiB
14Elfogadva2/28ms828 KiB
15Elfogadva2/212ms1076 KiB
16Elfogadva2/212ms1332 KiB
17Elfogadva2/268ms2452 KiB
18Elfogadva2/2109ms3196 KiB
19Elfogadva2/2115ms2948 KiB
20Elfogadva2/2115ms3000 KiB
21Elfogadva2/2109ms3240 KiB
22Elfogadva2/2123ms3624 KiB
23Elfogadva2/2122ms3368 KiB
24Elfogadva3/3134ms3624 KiB