답안 #438104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
438104 2021-06-27T14:57:08 Z yungyao Job Scheduling (CEOI12_jobs) C++17
20 / 100
281 ms 16936 KB
/*

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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 4300 KB Output isn't correct
2 Incorrect 34 ms 4268 KB Output isn't correct
3 Incorrect 38 ms 4336 KB Output isn't correct
4 Incorrect 30 ms 4284 KB Output isn't correct
5 Incorrect 38 ms 4316 KB Output isn't correct
6 Incorrect 30 ms 4288 KB Output isn't correct
7 Incorrect 30 ms 4288 KB Output isn't correct
8 Incorrect 30 ms 4336 KB Output isn't correct
9 Incorrect 37 ms 4292 KB Output isn't correct
10 Incorrect 37 ms 4348 KB Output isn't correct
11 Correct 30 ms 4172 KB Output is correct
12 Correct 58 ms 5700 KB Output is correct
13 Incorrect 84 ms 7976 KB Output isn't correct
14 Correct 134 ms 10108 KB Output is correct
15 Incorrect 140 ms 11080 KB Output isn't correct
16 Correct 191 ms 13504 KB Output is correct
17 Incorrect 221 ms 16016 KB Output isn't correct
18 Incorrect 246 ms 15828 KB Output isn't correct
19 Incorrect 281 ms 16936 KB Output isn't correct
20 Incorrect 214 ms 15928 KB Output isn't correct