#include <bits/stdc++.h>
using namespace std;
int day, deadline, work;
const int N = 100001;
int workday[N] = {};
vector<int> general;
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]++;
}
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 << "\n";
break;
}
}
for(int i = 0;i < day;++i)
cout << "0\n";
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
256 ms |
1188 KB |
Output isn't correct |
2 |
Incorrect |
233 ms |
1188 KB |
Output isn't correct |
3 |
Incorrect |
228 ms |
1100 KB |
Output isn't correct |
4 |
Incorrect |
129 ms |
1188 KB |
Output isn't correct |
5 |
Incorrect |
110 ms |
1228 KB |
Output isn't correct |
6 |
Incorrect |
117 ms |
1092 KB |
Output isn't correct |
7 |
Incorrect |
117 ms |
1192 KB |
Output isn't correct |
8 |
Incorrect |
71 ms |
1100 KB |
Output isn't correct |
9 |
Incorrect |
156 ms |
1228 KB |
Output isn't correct |
10 |
Incorrect |
178 ms |
1176 KB |
Output isn't correct |
11 |
Incorrect |
24 ms |
1104 KB |
Output isn't correct |
12 |
Correct |
48 ms |
1988 KB |
Output is correct |
13 |
Incorrect |
105 ms |
2700 KB |
Output isn't correct |
14 |
Correct |
107 ms |
3508 KB |
Output is correct |
15 |
Incorrect |
180 ms |
4252 KB |
Output isn't correct |
16 |
Incorrect |
139 ms |
5052 KB |
Output isn't correct |
17 |
Incorrect |
185 ms |
5932 KB |
Output isn't correct |
18 |
Incorrect |
354 ms |
6664 KB |
Output isn't correct |
19 |
Incorrect |
413 ms |
7476 KB |
Output isn't correct |
20 |
Incorrect |
170 ms |
5932 KB |
Output isn't correct |