Submission #1002828

# Submission time Handle Problem Language Result Execution time Memory
1002828 2024-06-19T20:18:38 Z Juan Autobahn (COI21_autobahn) C++17
50 / 100
1 ms 600 KB
#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
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 424 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 424 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Runtime error 1 ms 344 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -