Submission #453016

# Submission time Handle Problem Language Result Execution time Memory
453016 2021-08-04T07:31:56 Z BT21tata Job Scheduling (CEOI12_jobs) C++17
0 / 100
195 ms 8148 KB
#include<bits/stdc++.h>
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
//mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

int n, d, m;
pii a[1000005];

bool check(int x)
{
    int day=1;
    while(day<=n)
    {
        if(day*x>n) break;
        //cout<<x<<' ' <<day<<' '<<a[day*x-1].F<<endl;
        if(a[day*x-1].F<day) return 0;
        day++;
    }
    return 1;
}

int main()
{
    SPEED;
    cin>>n>>d>>m;
    for(int i=0; i<m; i++)
    {
        cin>>a[i].F;
        a[i].F+=d;
        a[i].S=i;
    }
    sort(a, a+m);
    int l=1, r=m, mid;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(mid)) r=mid-1;
        else l=mid+1;
    }
    cout<<l<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1400 KB Output isn't correct
2 Incorrect 10 ms 1316 KB Output isn't correct
3 Incorrect 11 ms 1392 KB Output isn't correct
4 Incorrect 13 ms 1356 KB Output isn't correct
5 Incorrect 15 ms 1288 KB Output isn't correct
6 Incorrect 14 ms 1356 KB Output isn't correct
7 Incorrect 10 ms 1324 KB Output isn't correct
8 Incorrect 11 ms 1288 KB Output isn't correct
9 Incorrect 19 ms 1228 KB Output isn't correct
10 Incorrect 20 ms 1352 KB Output isn't correct
11 Incorrect 20 ms 1352 KB Output isn't correct
12 Incorrect 41 ms 2508 KB Output isn't correct
13 Incorrect 81 ms 3296 KB Output isn't correct
14 Incorrect 86 ms 4152 KB Output isn't correct
15 Incorrect 106 ms 4928 KB Output isn't correct
16 Incorrect 137 ms 5956 KB Output isn't correct
17 Incorrect 157 ms 6508 KB Output isn't correct
18 Incorrect 185 ms 7300 KB Output isn't correct
19 Incorrect 195 ms 8148 KB Output isn't correct
20 Incorrect 163 ms 6612 KB Output isn't correct