Submission #732180

# Submission time Handle Problem Language Result Execution time Memory
732180 2023-04-28T15:16:44 Z LKR__enjoyer Job Scheduling (CEOI12_jobs) C++17
0 / 100
476 ms 17576 KB
#include<vector>
#include <iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#include<cstdlib>
#define f first
#define sec second
#define pb push_back
typedef long long ll;
using namespace std;
int n,d,m;
vector<pair<int,int>> arr;
int zlicz[100001];
int zlicz2[100001];
bool spr(int x)
{   for(int i=1;i<=n-d;i++)zlicz2[i]=zlicz[i];
    for(int i=1;i<=n-d;i++)
    {
        zlicz2[i]=max(0,zlicz2[i]-x);
        zlicz2[i+1]+=zlicz2[i];
    }
    if(zlicz2[n-d])return 0; return 1;
}
int bin(int lo,int hi)
{
while(lo<hi)
{
    int mid=lo+(hi-lo)/2;
    if(spr(mid))hi=mid; else lo=mid+1;
}
    return lo;
}
int main()
{
    cin>>n>>d>>m;
    for(int i=0;i<m;i++)
    {int a; cin>>a; arr.pb({a,i+1}); zlicz[a]++;} sort(arr.begin(),arr.end());
    int res=bin(1,m);
    cout<<res<<endl;
    int curr=0;
    for(int i=1;i<=n-d;i++)
    {int licz=0;
        if(curr==m){cout<<'0'<<endl; continue;}
        while(licz<res)
        {licz++;
            if(arr[curr].f<=i){cout<<arr[curr].sec<<' '; curr++;}
        }
        cout<<'0'<<endl;
    }
    for(int i=0;i<d;i++)cout<<'0'<<endl;

        return 0;
}

Compilation message

jobs.cpp: In function 'bool spr(int)':
jobs.cpp:25:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   25 |     if(zlicz2[n-d])return 0; return 1;
      |     ^~
jobs.cpp:25:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   25 |     if(zlicz2[n-d])return 0; return 1;
      |                              ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 2096 KB Output isn't correct
2 Incorrect 44 ms 2072 KB Output isn't correct
3 Incorrect 42 ms 2088 KB Output isn't correct
4 Incorrect 42 ms 2096 KB Output isn't correct
5 Incorrect 42 ms 2084 KB Output isn't correct
6 Incorrect 44 ms 2080 KB Output isn't correct
7 Incorrect 45 ms 2176 KB Output isn't correct
8 Incorrect 42 ms 2128 KB Output isn't correct
9 Incorrect 155 ms 2648 KB Output isn't correct
10 Incorrect 155 ms 2828 KB Output isn't correct
11 Incorrect 39 ms 2180 KB Output isn't correct
12 Incorrect 86 ms 3936 KB Output isn't correct
13 Incorrect 121 ms 5832 KB Output isn't correct
14 Incorrect 178 ms 8292 KB Output isn't correct
15 Incorrect 216 ms 9640 KB Output isn't correct
16 Incorrect 259 ms 12156 KB Output isn't correct
17 Incorrect 331 ms 14036 KB Output isn't correct
18 Incorrect 338 ms 15228 KB Output isn't correct
19 Incorrect 476 ms 17576 KB Output isn't correct
20 Incorrect 307 ms 14132 KB Output isn't correct