Submission #1002755

# Submission time Handle Problem Language Result Execution time Memory
1002755 2024-06-19T19:23:03 Z gabistroeh Autobahn (COI21_autobahn) C++14
0 / 100
1 ms 344 KB
#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

autobahn.cpp: In function 'int main()':
autobahn.cpp:21:7: warning: unused variable 'pes' [-Wunused-variable]
   21 |   int pes = 0;
      |       ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -