제출 #418134

#제출 시각아이디문제언어결과실행 시간메모리
418134freshminttJob Scheduling (CEOI12_jobs)C++11
0 / 100
1 ms460 KiB
#include<bits/stdc++.h>
#define MAXN 10 //change
using namespace std;
typedef pair<long long,long long> pi;
typedef long long ll;
typedef long double ld;
ll N, D, M;

#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
ll jobs[MAXN];
ll days[MAXN];

bool works(ll machs) {
  fill(days, days+MAXN, 0);
  for (int i=0; i < N; i++) {
    ll machID = i % machs;
    days[machID]++;
    if ((days[machID] - jobs[i]) > D) return false;
  }
  return true;
}

int main() { 
  // freopen("in", "r", stdin); // comment out
  FIO;
  cin >> N >> D >> M;

  
  for (int i = 0; i < N; i ++) cin >> jobs[i];

  ll a = 1; ll b = 1E9; ll mid;
  while (a != b) {
    mid = (a+b)/2;
    if (works(mid)) {
      b = mid;
    }
    else {
      a = mid + 1;
    }
  }

  cout << mid;



}   
#Verdict Execution timeMemoryGrader output
Fetching results...