Submission #988487

# Submission time Handle Problem Language Result Execution time Memory
988487 2024-05-25T03:14:26 Z hansenhe Job Scheduling (CEOI12_jobs) C++14
0 / 100
7 ms 5424 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, d, m;
pair<int, int> req[100];
vector<vector<int>> out;
bool good(int mach){
    vector<vector<int>> each(n + 1);
    vector<int> day(mach + 1);
    int cur = 1;
    for (int i = 0; i < m; i++){
        day[cur] = max(day[cur] + 1, req[i].first);
        each[day[cur]].push_back(req[i].second);
        if (day[cur] - req[i].first > d){
            return false;
        }
        cur++;
        cur %= mach;
        if (cur == 0) cur = mach;
    }
    out = each;
    return true;
}
signed main(){
    ios::sync_with_stdio(false);
	cin.tie(nullptr);
	// freopen("split.in", "r", stdin);
	// freopen("split.out", "w", stdout);
    cin >> n >> d >> m;
    for (int i = 0; i < m; i++){
        cin >> req[i].first;
        req[i].second = i + 1;
    }
    sort(req, req + m);
    int a = 1, b = m;
    while (a != b){
        int mid = (a + b) / 2;
        if (good(mid)){
            b = mid;
        } else {
            a = mid + 1;
        }
    }
    cout << a << "\n";
    for (int i = 1; i <= n; i++){
        for (int x : out[i]){
            cout << x << " ";
        }
        cout << "0\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 880 KB Output isn't correct
2 Incorrect 2 ms 876 KB Output isn't correct
3 Incorrect 2 ms 880 KB Output isn't correct
4 Incorrect 1 ms 876 KB Output isn't correct
5 Incorrect 1 ms 880 KB Output isn't correct
6 Incorrect 1 ms 880 KB Output isn't correct
7 Incorrect 1 ms 880 KB Output isn't correct
8 Incorrect 2 ms 880 KB Output isn't correct
9 Incorrect 7 ms 5424 KB Output isn't correct
10 Incorrect 6 ms 5172 KB Output isn't correct
11 Runtime error 2 ms 600 KB Execution killed with signal 11
12 Runtime error 1 ms 604 KB Execution killed with signal 11
13 Runtime error 1 ms 604 KB Execution killed with signal 11
14 Runtime error 1 ms 604 KB Execution killed with signal 11
15 Incorrect 1 ms 348 KB Output isn't correct
16 Runtime error 1 ms 472 KB Execution killed with signal 11
17 Runtime error 1 ms 604 KB Execution killed with signal 11
18 Runtime error 2 ms 600 KB Execution killed with signal 11
19 Runtime error 1 ms 856 KB Execution killed with signal 11
20 Runtime error 1 ms 604 KB Execution killed with signal 11