Submission #333381

# Submission time Handle Problem Language Result Execution time Memory
333381 2020-12-05T19:25:15 Z siddarthm Job Scheduling (CEOI12_jobs) C++11
0 / 100
303 ms 2156 KB
#include <iostream>
#include <algorithm>
using namespace std;

pair<int,int> orders[100000];
int n,d,m;
int backlog[100000];

bool works(int x)
{
    //cout << x << endl;
    for(int i=0; i<x; i++)
    {
        backlog[i] = 0;
    }
    for(int i=0; i<m; i++)
    {
        int current = (i/x)+1;
        if(current>(orders[i].first+x))
            return false;
    }
    return true;
}

int main(){
    cin >> n >> d >> m;
    for(int i=0; i<m; i++)
    {
        cin >> orders[i].first;
        orders[i].second = i+1;
    }
    sort(orders, orders+m);
    int a = 1;
    int b = m;
    while(a!=b)
    {
        int mid = (a+b)/2;
        if(works(mid))
            b = mid;
        else
            a = mid+1;
        //cout << endl;
    }
    cout << a << endl;
    int counter = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<a; j++)
        {
            if(counter==m)
                continue;
            cout << orders[counter].second << " ";
            counter++;
        }
        cout << 0 << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 1900 KB Output isn't correct
2 Incorrect 69 ms 1900 KB Output isn't correct
3 Incorrect 71 ms 2028 KB Output isn't correct
4 Incorrect 70 ms 1900 KB Output isn't correct
5 Incorrect 69 ms 1900 KB Output isn't correct
6 Incorrect 68 ms 1900 KB Output isn't correct
7 Incorrect 71 ms 1900 KB Output isn't correct
8 Incorrect 73 ms 1900 KB Output isn't correct
9 Incorrect 303 ms 2156 KB Output isn't correct
10 Incorrect 299 ms 2156 KB Output isn't correct
11 Incorrect 57 ms 1900 KB Output isn't correct
12 Runtime error 25 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 25 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 28 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 25 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 28 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 28 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 25 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 24 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 28 ms 2028 KB Execution killed with signal 11 (could be triggered by violating memory limits)