답안 #239288

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239288 2020-06-15T08:27:53 Z dCoding Job Scheduling (CEOI12_jobs) C++14
55 / 100
263 ms 13944 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>

#define ll long long int
#define F0R(i,n) for(auto i = 0; i < (n); i++)
#define FOR(i,a,b) for(auto i = (a); i <= (b); i++)
#define ROF(i,a,b) for(auto i = (a); i >= (b); i--)
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define vv vector
#define F first
#define S second
#define pb push_back
#define vi vector<int>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,d,m; cin >> n >> d >> m;
	pii a[m+5]; FOR(i,1,m) cin >> a[i].F;
	FOR(i,1,m)a[i].S = i;
	sort(a+1,a+m+1);
	int dayNumber = 1, jobNumber = 1, machines = 1;
	while(jobNumber < m) {
		if(dayNumber-a[jobNumber].F > d) {
			machines++;
			jobNumber = machines*(dayNumber-1)+1;
		} 
		if(jobNumber/machines == dayNumber && jobNumber % machines == 0)++dayNumber;
		jobNumber++;
	}
	if((machines*m) % n != 0) ++machines;
	cout << machines << "\n";
	jobNumber = 1;
	F0R(i,n) {
		F0R(j,machines) {
			if(jobNumber > m) {
				cout << "0\n";
				goto nextDay;
			} else {
				cout << a[jobNumber++].S << " ";
			}
		}
	
		cout << "0\n";
		nextDay:;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 1792 KB Output isn't correct
2 Incorrect 22 ms 1792 KB Output isn't correct
3 Incorrect 22 ms 1792 KB Output isn't correct
4 Incorrect 23 ms 1792 KB Output isn't correct
5 Incorrect 22 ms 1792 KB Output isn't correct
6 Incorrect 21 ms 1792 KB Output isn't correct
7 Incorrect 23 ms 1784 KB Output isn't correct
8 Incorrect 22 ms 1792 KB Output isn't correct
9 Correct 33 ms 1920 KB Output is correct
10 Correct 34 ms 1932 KB Output is correct
11 Correct 30 ms 1664 KB Output is correct
12 Correct 58 ms 3320 KB Output is correct
13 Correct 85 ms 4728 KB Output is correct
14 Correct 117 ms 6136 KB Output is correct
15 Incorrect 148 ms 7672 KB Output isn't correct
16 Correct 178 ms 9208 KB Output is correct
17 Correct 210 ms 10616 KB Output is correct
18 Correct 238 ms 12152 KB Output is correct
19 Correct 263 ms 13944 KB Output is correct
20 Correct 209 ms 10616 KB Output is correct