답안 #157780

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
157780 2019-10-12T21:54:43 Z InfiniteJest Job Scheduling (CEOI12_jobs) C++14
55 / 100
822 ms 13864 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<m;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;
    }
  }
  int f=0;
  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;
    f++;
  }
  for(int i=f+1;i<=n;i++){
    cout<<0<<endl;
  }


}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 1912 KB Output isn't correct
2 Incorrect 74 ms 1656 KB Output isn't correct
3 Incorrect 74 ms 1656 KB Output isn't correct
4 Incorrect 75 ms 1784 KB Output isn't correct
5 Incorrect 74 ms 1656 KB Output isn't correct
6 Incorrect 75 ms 1852 KB Output isn't correct
7 Incorrect 74 ms 1784 KB Output isn't correct
8 Incorrect 74 ms 1924 KB Output isn't correct
9 Correct 318 ms 1920 KB Output is correct
10 Correct 319 ms 1944 KB Output is correct
11 Correct 64 ms 1912 KB Output is correct
12 Correct 125 ms 3192 KB Output is correct
13 Correct 185 ms 4732 KB Output is correct
14 Correct 303 ms 6268 KB Output is correct
15 Incorrect 321 ms 7632 KB Output isn't correct
16 Correct 438 ms 9208 KB Output is correct
17 Correct 507 ms 10764 KB Output is correct
18 Correct 525 ms 12204 KB Output is correct
19 Correct 822 ms 13864 KB Output is correct
20 Correct 506 ms 10716 KB Output is correct