Submission #1027948

# Submission time Handle Problem Language Result Execution time Memory
1027948 2024-07-19T11:54:18 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
40 / 100
221 ms 26920 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, docnenje, m;
    cin>>n>>docnenje>>m;
    pair<int, int>a[m];
    for(int i=0; i<m; i++)
    {
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a, a+m);
    int l=0, r=m-1;
    vector<vector<int>>sol(n+1);
    while(r-l>1)
    {
        vector<vector<int>>rez(n+1);
        int mid=(l+r)/2;
        int index=0;
        bool kiki1=0;
        bool found=0;
        for(int i=1; i<=n && !found; i++)
        {
            bool kiki=0;
            for(int j=0; j<mid; j++)
            {
                if(a[index].first+docnenje<i)
                {
                    kiki=1;
                    break;
                }
                if(a[index].first>i)
                    break;
                index++;
                rez[i].push_back(a[index].second);
                if(index==m)
                {
                    sol=rez;
                    found=1;
                    break;
                }
            }
            if(kiki)
            {
                kiki1=1;
                break;
            }
        }
        if(kiki1)
            l=mid;
        else
            r=mid;
    }
    cout<<r<<"\n";
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<sol[i].size(); j++)
            cout<<sol[i][j]+1<<" ";
        cout<<"0\n";
    }

    return 0;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:60:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(int j=0; j<sol[i].size(); j++)
      |                      ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 33 ms 3396 KB Partially correct
2 Partially correct 26 ms 3404 KB Partially correct
3 Partially correct 35 ms 3404 KB Partially correct
4 Partially correct 21 ms 3404 KB Partially correct
5 Partially correct 24 ms 3404 KB Partially correct
6 Partially correct 18 ms 3408 KB Partially correct
7 Partially correct 30 ms 3460 KB Partially correct
8 Partially correct 21 ms 3408 KB Partially correct
9 Partially correct 35 ms 7772 KB Partially correct
10 Partially correct 33 ms 7672 KB Partially correct
11 Partially correct 29 ms 2708 KB Partially correct
12 Partially correct 51 ms 5272 KB Partially correct
13 Partially correct 72 ms 8168 KB Partially correct
14 Partially correct 139 ms 11496 KB Partially correct
15 Partially correct 120 ms 12532 KB Partially correct
16 Partially correct 183 ms 15464 KB Partially correct
17 Partially correct 213 ms 20008 KB Partially correct
18 Partially correct 221 ms 20580 KB Partially correct
19 Partially correct 218 ms 26920 KB Partially correct
20 Partially correct 188 ms 20024 KB Partially correct