#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
vector<int> l, r, s, last_run, machine_run_list;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, q, i, day, task, machine, past_days, num_inspect;
cin >> n >> m >> q;
l = vector<int>(m + 1);
r = vector<int>(m + 1);
for (i = 1; i <= m; i++) {
cin >> l[i] >> r[i];
for (machine = l[i]; machine <= r[i]; machine++) {
machine_run_list.push_back(machine);
}
}
s = vector<int>(q + 1);
for (i = 1; i <= q; i++) {
cin >> s[i];
last_run = vector<int>(n + 1, -1);
day = 1;
num_inspect = 0;
for (auto machine : machine_run_list) {
if (last_run[machine] == -1) {
// it has never been ran
last_run[machine] = day;
day++;
continue;
}
past_days = day - last_run[machine] - 1;
if (past_days >= s[i]) {
num_inspect++;
}
last_run[machine] = day;
day++;
}
cout << num_inspect << " ";
}
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |