# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
362072 | evn | Job Scheduling (CEOI12_jobs) | C++14 | 302 ms | 12880 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
typedef long long ll;
typedef pair<int, int> pii;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
vector<pii> jobs;
bool ok(int x){
vector<int> last(x);
for(int i = 0; i < jobs.size(); i++){
int machine = i%x;
last[machine] = max(last[machine]+1, jobs[i].f);
if(last[machine] - jobs[i].f >= x)return false;
}
return true;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, D, M;
cin >> N >> D >> M;
for(int i = 0; i < M;i ++){
int x;
cin >> x;
jobs.pb({x,i});
}
sort(jobs.begin(), jobs.end());
int lo = 1;
int hi = 1000000;
while(lo < hi){
int mid = (lo+hi)/2;
if(ok(mid)){
//answer could be lower
hi = mid;
}
else{
lo = mid+1;
}
}
cout << lo << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |