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 <iostream>
using namespace std;
const int MAX = 1069;
int n, k, x;
int people[MAX];
int fee[MAX];
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> k >> x;
for (int i = 0; i < n; ++i)
{
int l, t, r;
cin >> l >> t >> r;
people[l]++;
people[r+1]--;
l += t;
if (l <= r)
fee[l]++, fee[r+1]--;
}
for (int i = 1; i < MAX; ++i)
fee[i] += fee[i-1], people[i] += people[i-1];
for (int i = 1; i < MAX; ++i)
if (people[i] < k)
fee[i] = 0;
for (int i = 1; i < MAX; ++i)
fee[i] += fee[i-1];
int res = 0;
for (int i = 1; i + x - 1 < MAX; ++i)
{
int sum = fee[i + x - 1] - fee[i-1];
res = max(res, sum);
}
cout << res << '\n';
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... |