Submission #1339551

#TimeUsernameProblemLanguageResultExecution timeMemory
1339551phat11252Job Scheduling (CEOI12_jobs)C++20
0 / 100
171 ms18136 KiB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

#define all(x) (x).begin(), (x).end()

const int MOD = 1e9 + 7;
vector<int> cnt[100100];
bool ok(int mid)
{
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, d, m;
    cin >> n >> d >> m;
    for (int i = 1; i <= m; i++)
    {
        int x;
        cin >> x;
        cnt[x].push_back(i);
    }
    int l = 1, r = m;
    while (l <= r)
    {
        if (l == r)
            cout << l << '\n';
        int mid = (l + r) / 2;
        int currday = 0;
        queue<pii> q;
        for (int i = 1; i <= n; i++)
        {
            for (auto &j : cnt[i])
                q.push({j, i});
        }
        while (!q.empty())
        {
            currday++;
            while (currday < q.front().second)
            {
                if (l == r)
                    cout << 0 << '\n';
                currday++;
            }
            for (int i = 1; !q.empty() && i <= mid && q.front().second <= currday; i++)
            {
                if (l == r)
                    cout << q.front().first << ' ';
                q.pop();
            }
            if (l == r)
                cout << "0\n";
        }
        while (l == r && currday < n)
        {
            cerr << currday << '\n';
            cout << "0\n";
            currday++;
        }
        if (l == r)
            break;
        if (currday <= n + d)
            r = mid;
        else
            l = mid + 1;
    }

    return 0;
}

Compilation message (stderr)

jobs.cpp: In function 'bool ok(int)':
jobs.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...