Submission #239289

# Submission time Handle Problem Language Result Execution time Memory
239289 2020-06-15T08:28:55 Z dCoding Job Scheduling (CEOI12_jobs) C++14
0 / 100
185 ms 7424 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:;
	// }
}
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1152 KB Output isn't correct
2 Incorrect 13 ms 1152 KB Output isn't correct
3 Incorrect 13 ms 1152 KB Output isn't correct
4 Incorrect 13 ms 1152 KB Output isn't correct
5 Incorrect 13 ms 1152 KB Output isn't correct
6 Incorrect 12 ms 1152 KB Output isn't correct
7 Incorrect 13 ms 1152 KB Output isn't correct
8 Incorrect 12 ms 1152 KB Output isn't correct
9 Incorrect 24 ms 1152 KB Unexpected end of file - int32 expected
10 Incorrect 22 ms 1152 KB Unexpected end of file - int32 expected
11 Incorrect 22 ms 1152 KB Unexpected end of file - int32 expected
12 Incorrect 41 ms 1920 KB Unexpected end of file - int32 expected
13 Incorrect 62 ms 2688 KB Unexpected end of file - int32 expected
14 Incorrect 83 ms 3456 KB Unexpected end of file - int32 expected
15 Incorrect 103 ms 4304 KB Output isn't correct
16 Incorrect 131 ms 4992 KB Unexpected end of file - int32 expected
17 Incorrect 144 ms 5760 KB Unexpected end of file - int32 expected
18 Incorrect 171 ms 6528 KB Unexpected end of file - int32 expected
19 Incorrect 185 ms 7424 KB Unexpected end of file - int32 expected
20 Incorrect 152 ms 5888 KB Unexpected end of file - int32 expected