# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
565654 | PranjalChandra | Job Scheduling (CEOI12_jobs) | C++14 | 362 ms | 36412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <limits.h>
#define ll long long
#define ull unsigned long long
#define INF 1000000007
#define fastio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
using namespace std;
ll n, d, t;
vector<pair<ll, ll>> dates;
vector<vector<ll>> ans;
bool ok(ll x)
{
ans.clear();
ll machines = 1;
ll day = 1;
vector<ll> tmp;
for (ll i = 1; i <= t; i++)
{
if (day < dates[i].first)
{
day = dates[i].first;
machines = 1;
}
if (day - dates[i].first > d)
return 0;
++machines;
tmp.push_back(dates[i].second);
if (machines > x)
{
ans.push_back(tmp);
tmp.clear();
machines = 1;
++day;
}
}
return true;
}
int main()
{
fastio();
cin >> n >> d >> t;
dates.push_back({-1, -1});
for (ll i = 1; i <= t; i++)
{
ll x;
cin >> x;
dates.push_back({x, i});
}
sort(dates.begin(), dates.end());
ll l = 0;
ll r = t;
while (r > l + 1)
{
ll m = l + (r - l) / 2;
if (ok(m))
r = m;
else
l = m;
}
ok(r);
cout << r << "\n";
for (auto v : ans)
{
for (auto e : v)
{
cout << e << " ";
}
cout << "0\n";
}
for (ll i = 1; i <= n - ans.size(); ++i)
cout << 0 << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |