Submission #414398

# Submission time Handle Problem Language Result Execution time Memory
414398 2021-05-30T11:55:49 Z med2 Autobahn (COI21_autobahn) C++14
0 / 100
2 ms 204 KB
#include <bits/stdc++.h>
#define ll  long long
#define endl    "\n"
using namespace std;
const ll N=2009;
int main() {
    
    ll n,k,x;
    cin>>n>>k>>x;
    ll count[N]={0};
    ll ans[N]={0};
    for(int i=0;i<n;i++){
        ll x,y,z;
        cin>>x>>y>>z;
        x--;
        z--;
        y--;
        count[x]++;
        count[z]--;
        ans[min(z,x+y)]++;
        ans[z]--;
    }
    for(int i=1;i<N;i++){
        count[i]+=count[i-1];
        ans[i]+=ans[i-1];    
    }
    ll answer=0;
    for(int i=0;i<1009;i++){
        ll cou=0;
        for(int j=i;j<i+x;j++){
            if(count[j]>=k)
            cou+=ans[j];
        }
        answer=max(answer,cou);
    }
    cout<<answer<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 2 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 2 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 2 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -