# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48455 | 2018-05-13T16:21:50 Z | IvanC | Job Scheduling (CEOI12_jobs) | C++17 | 258 ms | 8888 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; vector<ii> pares; int N,D,M; int checa(int X){ int disponivel = X; int dia = 1; for(int i = 0;i<M;i++){ if(disponivel == 0){ dia++; disponivel = X; } if(pares[i].first + D < dia) return 0; disponivel--; } return 1; } int main(){ scanf("%d %d %d",&N,&D,&M); for(int i = 1;i<=M;i++){ int x; scanf("%d",&x); pares.push_back(ii(x,i)); } sort(pares.begin(),pares.end()); int ini = 1,fim = M,meio,resp; while(ini <= fim){ meio = ini + (fim - ini)/2; if(checa(meio)){ resp = meio; fim = meio - 1; } else{ ini = meio + 1; } } printf("%d\n",resp); return 0; int disponivel = resp,dia = 1; for(int i = 0;i<M;i++){ if(disponivel == 0){ printf("0\n"); disponivel = resp; dia++; } printf("%d ",pares[i].second); disponivel--; } while(dia <= N){ printf("0\n"); dia++; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 1388 KB | Output isn't correct |
2 | Incorrect | 21 ms | 1628 KB | Output isn't correct |
3 | Incorrect | 20 ms | 1628 KB | Output isn't correct |
4 | Incorrect | 21 ms | 1628 KB | Output isn't correct |
5 | Incorrect | 17 ms | 1628 KB | Output isn't correct |
6 | Incorrect | 19 ms | 1628 KB | Output isn't correct |
7 | Incorrect | 16 ms | 1628 KB | Output isn't correct |
8 | Incorrect | 18 ms | 1628 KB | Output isn't correct |
9 | Incorrect | 32 ms | 1656 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 34 ms | 1656 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 42 ms | 1656 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 54 ms | 2680 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 82 ms | 4748 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 112 ms | 4748 KB | Unexpected end of file - int32 expected |
15 | Incorrect | 135 ms | 4880 KB | Output isn't correct |
16 | Incorrect | 172 ms | 8888 KB | Unexpected end of file - int32 expected |
17 | Incorrect | 210 ms | 8888 KB | Unexpected end of file - int32 expected |
18 | Incorrect | 246 ms | 8888 KB | Unexpected end of file - int32 expected |
19 | Incorrect | 258 ms | 8888 KB | Unexpected end of file - int32 expected |
20 | Incorrect | 200 ms | 8888 KB | Unexpected end of file - int32 expected |