Submission #743192

# Submission time Handle Problem Language Result Execution time Memory
743192 2023-05-17T08:43:36 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
436 ms 11068 KB
#include <bits/stdc++.h>
using namespace std;
int day, deadline, work;
const int N = 100001;
int workday[N] = {};
vector<int> general;
vector<int> realw;

bool solve(int maxmachine)
{
    int workleft = work;
    int day = 1;
    vector<int> soil = general;
    while (workleft > 0 && !soil.empty())
    {
        for (int i = 0; i < maxmachine; ++i)
        {
            if (soil.back() + deadline < day)
                return false;
            else
            {
                workleft--;
                soil.pop_back();
            }
        }
        day++;
    }
    return true;
}

int main()
{
    int a;
    cin >> day >> deadline >> work;
    for (int i = 0; i < work; ++i)
    {
        cin >> a;
        workday[a]++;
        realw.push_back(a);
    }
    int maxwork = -1;
    for (int i = 1; i <= day - deadline; ++i)
    {
        maxwork = max(maxwork, workday[i]);
        for (int j = 1; j <= workday[i]; ++j)
            general.push_back(i);
    }
    reverse(general.begin(), general.end());
    for (int i = 1; i <= work; ++i)
    {
        if (solve(i))
        {
            cout << i;
            break;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 242 ms 1616 KB Output isn't correct
2 Incorrect 249 ms 1616 KB Output isn't correct
3 Incorrect 226 ms 1616 KB Output isn't correct
4 Incorrect 127 ms 1576 KB Output isn't correct
5 Incorrect 111 ms 1616 KB Output isn't correct
6 Incorrect 120 ms 1540 KB Output isn't correct
7 Incorrect 129 ms 1560 KB Output isn't correct
8 Incorrect 71 ms 1480 KB Output isn't correct
9 Incorrect 136 ms 1536 KB Output isn't correct
10 Incorrect 167 ms 1588 KB Output isn't correct
11 Incorrect 25 ms 1616 KB Output isn't correct
12 Incorrect 51 ms 2776 KB Unexpected end of file - int32 expected
13 Incorrect 97 ms 4492 KB Output isn't correct
14 Incorrect 104 ms 5076 KB Unexpected end of file - int32 expected
15 Incorrect 219 ms 6292 KB Output isn't correct
16 Incorrect 156 ms 8768 KB Output isn't correct
17 Incorrect 189 ms 9412 KB Output isn't correct
18 Incorrect 329 ms 9780 KB Output isn't correct
19 Incorrect 436 ms 11068 KB Output isn't correct
20 Incorrect 180 ms 9136 KB Output isn't correct