# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1002755 | gabistroeh | Autobahn (COI21_autobahn) | C++14 | 1 ms | 344 KiB |
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;
const int MAXN = 1010;
int l[MAXN], r[MAXN], t[MAXN], mark[MAXN];
int v[MAXN];
int seg[4*MAXN];
int main(){
int n, k, x;
cin >> n >> k >> x;
for(int i=0; i<n; i++){
cin >> l[i] >> t[i] >> r[i];
for(int j=l[i]; j<=r[i]; j++){
mark[j]++;
}
}
for(int i=0; i<n; i++){
int tam = r[i] - l[i] + 1;
if(t[i]>=tam) continue;
int pes = 0;
for(int j=l[i]+t[i]; j<=r[i]; j++){
if(mark[j]>=k){
v[j]++;
}
}
}
//for(int i=1; i<10; i++) cout << v[i] << " ";
int resp = 0;
for(int i=1; i<=1000-k+1; i++){
int cur = 0;
for(int j=i; j<=i+k; j++){
cur+=v[j];
}
//if(cur>resp) cout << cur << endl;
resp = max(resp, cur);
}
cout << resp;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |