Submission #520568

# Submission time Handle Problem Language Result Execution time Memory
520568 2022-01-30T09:15:57 Z Vimmer Autobahn (COI21_autobahn) C++14
0 / 100
0 ms 204 KB
#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, l - x + 1); l--)
        {
            if (kl[l] >= k)
                skok += klr[l];

            ans = max(ans, skok);
        }
    }

    pri(ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -