Submission #1027932

# Submission time Handle Problem Language Result Execution time Memory
1027932 2024-07-19T11:45:11 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
220 ms 30336 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=n-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<<"\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 Incorrect 11 ms 2000 KB Output isn't correct
2 Incorrect 14 ms 2148 KB Output isn't correct
3 Incorrect 8 ms 2156 KB Output isn't correct
4 Incorrect 9 ms 2000 KB Output isn't correct
5 Incorrect 16 ms 2000 KB Output isn't correct
6 Incorrect 9 ms 2000 KB Output isn't correct
7 Incorrect 8 ms 2160 KB Output isn't correct
8 Incorrect 8 ms 2000 KB Output isn't correct
9 Incorrect 30 ms 7776 KB Unexpected end of file - int32 expected
10 Incorrect 29 ms 7872 KB Unexpected end of file - int32 expected
11 Incorrect 21 ms 3156 KB Unexpected end of file - int32 expected
12 Incorrect 40 ms 6088 KB Unexpected end of file - int32 expected
13 Incorrect 65 ms 9292 KB Unexpected end of file - int32 expected
14 Incorrect 105 ms 13424 KB Unexpected end of file - int32 expected
15 Incorrect 101 ms 14604 KB Unexpected end of file - int32 expected
16 Incorrect 147 ms 18536 KB Unexpected end of file - int32 expected
17 Incorrect 173 ms 22888 KB Unexpected end of file - int32 expected
18 Incorrect 175 ms 23652 KB Unexpected end of file - int32 expected
19 Incorrect 220 ms 30336 KB Unexpected end of file - int32 expected
20 Incorrect 185 ms 23140 KB Unexpected end of file - int32 expected