Submission #104821

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1048212019-04-09 10:12:19WLZJob Scheduling (CEOI12_jobs)C++17
100 / 100
239 ms20216 KiB
#include <bits/stdc++.h>
using namespace std;
int n, d, m;
vector<int> a;
vector< vector<int> > v;
int check(int k) {
int last = 0, cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] == 0) {
continue;
}
int left = a[i];
int pos = d + 1;
if (last >= i) {
left -= k - cnt;
pos = i + d - last;
}
if ((left + k - 1) / k > pos) {
return 0;
}
if (last >= i) {
last += 1 + left / k;
} else {
last = i + left / k;
}
cnt = left % k;
}
return 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

jobs.cpp: In function 'int main()':
jobs.cpp:59:43: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
       while ((int) ansv[pos].size() < ans && !v[i].empty()) {
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...