Submission #466112

# Submission time Handle Problem Language Result Execution time Memory
466112 2021-08-18T01:21:28 Z nehasane Job Scheduling (CEOI12_jobs) C++14
10 / 100
435 ms 13536 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, d, m;
    cin >> n >> d >> m;
    vector <pair<int, int>> jobs(m);
    for (int i = 0; i < m; i++){
        cin >> jobs[i].first;
        jobs[i].second = i;
    }
    sort(begin(jobs), end(jobs));
    int l = 1, r = m;
    while (l <= r){
        int mid = (l+r) / 2;
        int day = 0, i = 0, start = 0;
        while (i < m){
            for (i; i < min(m, start+mid); i++){
                if (day > jobs[i].first + d){
                    start = INT_MAX;
                    break;
                }
            }
            if (start == INT_MAX)
                break;
            else
                start = i;
            day++;
        }
        if (start == INT_MAX || day > n)
            l = mid + 1;
        else
            r = mid - 1;
    }
    cout << l << '\n';
    int i = 0;
    while (i < m){
        int s = i;
        for (i; i < min(m, s+l); i++)
            cout << jobs[i].second + 1 << ' ';
        cout << 0 << '\n';
    }
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:18:18: warning: statement has no effect [-Wunused-value]
   18 |             for (i; i < min(m, start+mid); i++){
      |                  ^
jobs.cpp:39:14: warning: statement has no effect [-Wunused-value]
   39 |         for (i; i < min(m, s+l); i++)
      |              ^
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 1584 KB Output isn't correct
2 Incorrect 36 ms 1652 KB Output isn't correct
3 Incorrect 37 ms 1616 KB Output isn't correct
4 Incorrect 36 ms 1604 KB Output isn't correct
5 Incorrect 36 ms 1576 KB Output isn't correct
6 Incorrect 37 ms 1600 KB Output isn't correct
7 Incorrect 36 ms 1584 KB Output isn't correct
8 Incorrect 36 ms 1588 KB Output isn't correct
9 Incorrect 42 ms 1588 KB Output isn't correct
10 Incorrect 42 ms 1592 KB Output isn't correct
11 Incorrect 48 ms 1604 KB Output isn't correct
12 Correct 100 ms 3144 KB Output is correct
13 Incorrect 143 ms 4552 KB Output isn't correct
14 Correct 217 ms 6120 KB Output is correct
15 Incorrect 245 ms 7524 KB Output isn't correct
16 Incorrect 309 ms 9068 KB Unexpected end of file - int32 expected
17 Incorrect 377 ms 10556 KB Output isn't correct
18 Incorrect 384 ms 11944 KB Output isn't correct
19 Incorrect 435 ms 13536 KB Output isn't correct
20 Incorrect 365 ms 10660 KB Output isn't correct