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<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
const int maxn = 1e3+5;
int sum_vermelha[maxn], sum_azul[maxn], p[maxn];
int main(){
int n,k,x; cin >> n >> k >> x;
for(int i=0; i<n; i++){
int l,t,r; cin >> l >> t >> r;
sum_azul[l]++, sum_azul[r+1]--;
if(t<r-l+1){
sum_vermelha[l+t]++;
sum_vermelha[r+1]--;
}
}
for(int i=1; i<=1000; i++){
sum_azul[i] += sum_azul[i-1];
sum_vermelha[i] += sum_vermelha[i-1];
}
for(int i=1; i<=1000; i++){
if(sum_azul[i]<k) sum_vermelha[i]=0;
}
int ans=0;
for(int i=1; i<=1000; i++){
p[i] = p[i-1]+sum_vermelha[i];
ans = max(ans,p[i]-p[max(0,i-x)]);
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |