제출 #520570

#제출 시각아이디문제언어결과실행 시간메모리
520570VimmerAutobahn (COI21_autobahn)C++14
50 / 100
2 ms460 KiB
#include <bits/stdc++.h> #define in(x) freopen(x, "r", stdin) #define out(x) freopen(x, "w", stdout) //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") #define F first #define S second #define PB push_back #define M ll(1e9 + 7) #define sz(x) (ll)x.size() #define N 1000500 #define pri(x) cout << x << endl #define endl '\n' #define all(x) (x).begin(), (x).end() #define _ << " " << using namespace std; //typedef tree <ll, null_type, less_equal <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set; //using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef short int si; typedef unsigned long long ull; int kl[2005]; int klr[2005]; int main() { istream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; vector <int> vr; vr.clear(); for (int i = 0; i < n; i++) { int l, r, t; cin >> l >> t >> r; for (int u = l + t; u <= r; u++) klr[u]++; for (int u = l; u <= r; u++) kl[u]++; vr.PB(r); } sort(all(vr)); vr.resize(unique(all(vr)) - vr.begin()); int ans = 0; for (auto r : vr) { int skok = 0; for (int l = r; l >= max(1, r - x + 1); l--) { if (kl[l] >= k) skok += klr[l]; ans = max(ans, skok); } } pri(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...