85222024-01-20 11:55:50TomaSajtMekk Mester munkái (50 pont)cpp17Wrong answer 7/5086ms7460 KiB
#include <bits/stdc++.h>
using namespace std;

struct job_t {
  int s, e, id;
};

int main() {
  int n, h;
  cin >> n >> h;
  vector<job_t> jobs;
  for (int i = 1; i <= n; i++) {
    int s, e;
    cin >> s >> e;
    jobs.push_back({s, e, i});
  }
  sort(jobs.begin(), jobs.end(), [](auto a, auto b) { return a.e < b.e; });

  int last_end_a = 0, last_end_b = 0;
  vector<int> done_job_ids_a, done_job_ids_b;
  for (auto [s, e, id] : jobs) {
    if (s > last_end_a) {
      last_end_a = e;
      done_job_ids_a.push_back(id);
    }
    else if (s > last_end_b) {
      last_end_b = e;
      done_job_ids_b.push_back(id);
    }
  }
  cout << done_job_ids_a.size() << ' ' << done_job_ids_b.size() << '\n';
  for (int id : done_job_ids_a) cout << id << ' ';
  cout << '\n';
  for (int id : done_job_ids_b) cout << id << ' ';
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1996 KiB
2Wrong answer0/08ms2800 KiB
3Accepted1/13ms2116 KiB
4Accepted1/13ms2224 KiB
5Wrong answer0/23ms2564 KiB
6Wrong answer0/23ms2696 KiB
7Accepted2/23ms2760 KiB
8Wrong answer0/23ms2896 KiB
9Accepted3/33ms3144 KiB
10Wrong answer0/13ms3400 KiB
11Wrong answer0/13ms3556 KiB
12Wrong answer0/23ms3632 KiB
13Wrong answer0/23ms3640 KiB
14Wrong answer0/23ms3636 KiB
15Wrong answer0/23ms3736 KiB
16Wrong answer0/33ms3764 KiB
17Wrong answer0/279ms7020 KiB
18Wrong answer0/279ms7176 KiB
19Wrong answer0/479ms7224 KiB
20Wrong answer0/479ms7424 KiB
21Wrong answer0/479ms7388 KiB
22Wrong answer0/481ms7388 KiB
23Wrong answer0/486ms7460 KiB