Submission #414429

# Submission time Handle Problem Language Result Execution time Memory
414429 2021-05-30T12:26:44 Z med2 Autobahn (COI21_autobahn) C++14
50 / 100
3 ms 460 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--;
       // y--;
        count[x]++;
        count[z]--;
        ans[min(z+1,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 276 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 276 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 324 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 276 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 324 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Runtime error 1 ms 460 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -