답안 #499968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499968 2021-12-30T07:09:42 Z kappa Autobahn (COI21_autobahn) C++14
0 / 100
1 ms 308 KB
#include <bits/stdc++.h>

using namespace std;

struct person{
    int begin;
    int pay;
    int end;
};

int n, k, x, maxEnd, ans, val[100005], p[100005];

person d[100005];

int main(){
    cin >> n >> k >> x;

    for (int i = 0; i < n; i++)
    {
        cin >> d[i].begin >> d[i].pay >> d[i].end;

        maxEnd = max(maxEnd, d[i].end);

        d[i].begin--;
        d[i].end--;
    }

    for (int i = 0; i < maxEnd; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(i >= d[j].begin && i <= d[j].end){
                p[i]++;
            }
        }
    }
    

    for (int i = 0; i < maxEnd; i++)
    {
        val[i] = val[i - 1];

        if(p[i] < k) continue;

        for (int j = 0; j < n; j++)
        {
            if(i > d[j].begin + d[j].pay - 1 && i >= d[j].begin && i <= d[j].end){
                //cout << "i " << i << " lim " << d[j].begin + d[j].pay - 1 << " bas " << d[j].begin << " son " << d[j].end << "\n";

                val[i]++;
            }
        }
    }

    for (int i = 0; i < maxEnd - x; i++)
    {
        ans = max(ans, val[i + x - 1] - val[i - 1]);
    }

    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 284 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Incorrect 1 ms 300 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 284 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Incorrect 1 ms 300 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 284 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Incorrect 1 ms 300 KB Output isn't correct
8 Halted 0 ms 0 KB -