답안 #416816

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
416816 2021-06-03T01:32:28 Z jackkkk Job Scheduling (CEOI12_jobs) C++11
55 / 100
423 ms 20924 KB
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <array>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <float.h>
#include <climits>

using namespace std;


void quit() {
  cout.flush();
  exit(0);
}
long long n, d, m;
vector <pair<long long ,long long>> requests;

bool good(long long machines){
  for(long long i = 0; i < m; i++){
    if((i/machines+1)-requests[i].first>d){
      return false;
    }
  }
  return true;
}



int main(void){
  //freopen("qwer.in", "r", stdin);
  //freopen("qwer.out", "w", stdout);
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n >> d >> m;
  requests.resize(m);
  for(long long i = 0; i < m; i++){
    cin >> requests[i].first;
    requests[i].second = i+1;
  }
  sort(requests.begin(), requests.end());
  
  long long s = 0, e = 1000000000;
  while(s!=e){
    long long mid = (s+e)/2;
    if(good(mid)){
      e=mid;
    }
    else{
      s=mid+1;
    }
  }
  cout << e << "\n";
  long long num_left = n;
  for(long long i = 0; i < m; i+=e){
    for(long long j = i; j < min(m, i+e); j++){
      cout << requests[j].second << " ";
    }
    num_left--;
    cout << "0\n";
  }
  for(long long i = 0; i < num_left; i++){
    cout << "0\n";
  }
  quit();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 2516 KB Output isn't correct
2 Incorrect 39 ms 2516 KB Output isn't correct
3 Incorrect 39 ms 2608 KB Output isn't correct
4 Incorrect 39 ms 2520 KB Output isn't correct
5 Incorrect 40 ms 2500 KB Output isn't correct
6 Incorrect 38 ms 2504 KB Output isn't correct
7 Incorrect 39 ms 2504 KB Output isn't correct
8 Incorrect 39 ms 2532 KB Output isn't correct
9 Correct 47 ms 2756 KB Output is correct
10 Correct 48 ms 2784 KB Output is correct
11 Correct 45 ms 2528 KB Output is correct
12 Correct 94 ms 4864 KB Output is correct
13 Correct 143 ms 7112 KB Output is correct
14 Correct 201 ms 9400 KB Output is correct
15 Incorrect 239 ms 11588 KB Output isn't correct
16 Correct 291 ms 13936 KB Output is correct
17 Correct 344 ms 16140 KB Output is correct
18 Correct 384 ms 18372 KB Output is correct
19 Correct 423 ms 20924 KB Output is correct
20 Correct 334 ms 16196 KB Output is correct