답안 #920448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
920448 2024-02-02T14:46:44 Z hasuhasuiro Autobahn (COI21_autobahn) C++17
50 / 100
80 ms 2776 KB
#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;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Incorrect 80 ms 2776 KB Output isn't correct
22 Halted 0 ms 0 KB -