# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
438104 | yungyao | Job Scheduling (CEOI12_jobs) | C++17 | 281 ms | 16936 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
weak weak we ak we akwea weak we
weak weak we ak weak weak we ak we
weakweak we ak wea ak we akwe
wea we ak we ak we akwe
wea we ak we ak we akwe
wea eak weak we ak we ak we
wea wea ak we ak weak we
we
we ak wea ak weak we
we ak wea weak wea eak we
we ak we ak wea wea we we
weak we ak we we we we
we we ak we we we we
we wea weak wea wea weak weak
weak wea akw weak weak
*/
using namespace std;
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <utility>
#include <bitset>
#include <set>
#include <string>
#include <stack>
#include <iomanip>
#include <map>
#include <memory.h>
#include <deque>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define LL long long
#define mid (LB+RB)/2
#define vvl vector <vector<LL>>
#define vl vector <LL>
#define mkp make_pair
//iterators
#define iter(x) x.begin(),x.end()
#define aiter(a,n) a,a+n
//loops
#define REP(n) for (int ___=n;___--;)
#define REP0(i,n) for (int i=0;i<n;++i)
#define REP1(i,n) for (int i=1;i<=n;++i)
#define FOR(i,b,l,k) for (int i=b;i!=l;i+=k)
#define forEach(i,v) for (auto i:v)
/*
yungyao so weeeeeeeeeeeeeeeeeeeeeeeeeeak
8e7 so dian
FHVirus so dian
youou so dian
KYW so dian
hubert so dian
jass so dian
tingyu so dian
panda so dian
*/
//IO
#include <iostream>
#define theyRSOOOOOOOOODIAN ios_base::sync_with_stdio(false),cin.tie(0);
//testing some stuff, still under construction
//a lot more useful while debug
inline void print(vector <int> v){
for (auto i:v)
cout << i << ' ';
cout << '\n';
}
inline void print(vector <int> v,char sep,char end){
for (auto i:v)
cout << i << sep;
cout << end;
}
//pbds
/*
using namespace __gnu_pbds;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
*/
//constants
#include <climits>
const int maxn = 1e5+10,mod = 0;
//workspace
int n,d;
vector <int> jobs[maxn];
bool bs(int m){
queue <int> q;
REP1(i,n){
REP(jobs[i].size()) q.push(i+d);
for (int c=m;q.size() && c--;) q.pop();
if (q.size() && q.front() < i) return false;
}
return true;
}
void printjobs(int m){
queue <int> q;
REP1(i,n){
for (auto j:jobs[i]) q.push(j);
for (int c=m;q.size() && c--;){
cout << q.front() << ' ';
q.pop();
}
cout << "0\n";
}
}
inline void solve(){
int m;
cin >> n >> d >> m;
REP1(i,m){
int x;
cin >> x;
jobs[x].pb(i);
}
int LB = 1,RB = 1e6;
while(LB != RB){
if (bs(mid))
RB = mid;
else
LB = mid+1;
}
cout << LB << '\n';
printjobs(LB);
}
signed main(){
theyRSOOOOOOOOODIAN
//for (int ;cin;)//use in multi-testcases and end in EOF problems
//int t,i=1;for (cin >> t;i<=t;++i)//use in multi-testcases problems
//cout << "Case #" << i << ": ",//use in Google, FB competitions
solve();//always used
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |