Submission #1002755

#TimeUsernameProblemLanguageResultExecution timeMemory
1002755gabistroehAutobahn (COI21_autobahn)C++14
0 / 100
1 ms344 KiB
#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)

autobahn.cpp: In function 'int main()':
autobahn.cpp:21:7: warning: unused variable 'pes' [-Wunused-variable]
   21 |   int pes = 0;
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...