답안 #239283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239283 2020-06-15T08:14:21 Z dCoding Job Scheduling (CEOI12_jobs) C++14
55 / 100
273 ms 13816 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++;
	}
	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 24 ms 1792 KB Output isn't correct
2 Incorrect 22 ms 1792 KB Output isn't correct
3 Incorrect 21 ms 1784 KB Output isn't correct
4 Incorrect 21 ms 1784 KB Output isn't correct
5 Incorrect 21 ms 1792 KB Output isn't correct
6 Incorrect 23 ms 1792 KB Output isn't correct
7 Incorrect 22 ms 1792 KB Output isn't correct
8 Incorrect 21 ms 1792 KB Output isn't correct
9 Correct 33 ms 1920 KB Output is correct
10 Correct 33 ms 2040 KB Output is correct
11 Correct 31 ms 1656 KB Output is correct
12 Correct 60 ms 3192 KB Output is correct
13 Correct 93 ms 4728 KB Output is correct
14 Correct 128 ms 6264 KB Output is correct
15 Incorrect 147 ms 7672 KB Output isn't correct
16 Correct 194 ms 9208 KB Output is correct
17 Correct 215 ms 10616 KB Output is correct
18 Correct 251 ms 12144 KB Output is correct
19 Correct 273 ms 13816 KB Output is correct
20 Correct 213 ms 10616 KB Output is correct