# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
920448 | hasuhasuiro | Autobahn (COI21_autobahn) | C++17 | 80 ms | 2776 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
long long X;
cin >> N >> K >> X;
vector l(N, 0LL), r(N, 0LL), t(N, 0LL);
for(int i = 0; i < N; i++) { cin >> l[i] >> t[i] >> r[i]; r[i]++; }
if(N <= 1010 && X <= 1010 && *max_element(begin(l), end(l)) <= 1010 && *max_element(begin(r), end(r)) <= 1010 && *max_element(begin(t), end(t)) <= 1010) {
vector imos1(1010, 0), imos2(1010, 0);
for(int i = 0; i < N; i++) {
imos1[l[i]]++, imos1[r[i]]--;
if(l[i]+t[i] < r[i]) { imos2[l[i]+t[i]]++, imos2[r[i]]--; }
}
for(int i = 0; i < 1005; i++) {
imos1[i+1] += imos1[i];
imos2[i+1] += imos2[i];
}
for(int i = 0; i < 1005; i++) { if(imos1[i] < K) { imos2[i] = 0; } }
int ans(0);
for(int i = 0; i < 1005-X; i++) {
int res(0);
for(int j = 0; j < X; j++) {
res += imos2[i+j];
}
ans = max(res, ans);
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |