Submission #420536

#TimeUsernameProblemLanguageResultExecution timeMemory
420536Drew_Autobahn (COI21_autobahn)C++17
50 / 100
1 ms332 KiB
#include <iostream> using namespace std; const int MAX = 1069; int n, k, x; int people[MAX]; int fee[MAX]; int main() { ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k >> x; for (int i = 0; i < n; ++i) { int l, t, r; cin >> l >> t >> r; people[l]++; people[r+1]--; l += t; if (l <= r) fee[l]++, fee[r+1]--; } for (int i = 1; i < MAX; ++i) fee[i] += fee[i-1], people[i] += people[i-1]; for (int i = 1; i < MAX; ++i) if (people[i] < k) fee[i] = 0; for (int i = 1; i < MAX; ++i) fee[i] += fee[i-1]; int res = 0; for (int i = 1; i + x - 1 < MAX; ++i) { int sum = fee[i + x - 1] - fee[i-1]; res = max(res, sum); } cout << res << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...