Submission #157776

# Submission time Handle Problem Language Result Execution time Memory
157776 2019-10-12T21:38:09 Z InfiniteJest Job Scheduling (CEOI12_jobs) C++14
0 / 100
820 ms 14116 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

ifstream in("input.txt");
ofstream out("output.txt");

typedef long long ll;

int n,dk,m;
pair<int,int> v[1000001];

bool funz(int k){
  int p=1;
  for(int i=0;i<m;i+=k){
    for(int y=i;y<i+k;y++){
      if(p>v[y].fi+dk)return 0;
    }
    p++;
  }
  return 1;
}

int main(){
  cin>>n>>dk>>m;
  for(int i=0;i<m;i++){
    cin>>v[i].fi;
    v[i].se=i;
  }
  sort(v,v+m);

  int s=1;
  int d=m;
  int minn=1e9;

  while(s<=d){
    int k=(s+d)/2;
    if(funz(k)){
      minn=min(minn,k);
      d=k-1;
    }
    else{
      s=k+1;
    }
  }
  cout<<minn<<endl;
  for(int i=0;i<m;i+=minn){
    for(int y=i;y<i+minn&&y<m;y++){
      cout<<v[y].se+1<<" ";
    }
    cout<<"0 "<<endl;
  }
  for(int i=m/minn+min(1,m%minn);i<n;i++){
    cout<<"0 "<<endl;
  }


}
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 1784 KB Output isn't correct
2 Incorrect 73 ms 1656 KB Output isn't correct
3 Incorrect 73 ms 1756 KB Output isn't correct
4 Incorrect 73 ms 1768 KB Output isn't correct
5 Incorrect 73 ms 1656 KB Output isn't correct
6 Incorrect 73 ms 1788 KB Output isn't correct
7 Incorrect 74 ms 1732 KB Output isn't correct
8 Incorrect 75 ms 1848 KB Output isn't correct
9 Incorrect 316 ms 2080 KB Output isn't correct
10 Incorrect 316 ms 2064 KB Output isn't correct
11 Incorrect 63 ms 1656 KB Output isn't correct
12 Incorrect 125 ms 3300 KB Output isn't correct
13 Incorrect 186 ms 4728 KB Output isn't correct
14 Incorrect 304 ms 6248 KB Output isn't correct
15 Incorrect 323 ms 7672 KB Output isn't correct
16 Incorrect 450 ms 9228 KB Output isn't correct
17 Incorrect 507 ms 10800 KB Output isn't correct
18 Incorrect 520 ms 12244 KB Output isn't correct
19 Incorrect 820 ms 14116 KB Output isn't correct
20 Incorrect 512 ms 10692 KB Output isn't correct