Submission #874472

# Submission time Handle Problem Language Result Execution time Memory
874472 2023-11-17T06:44:26 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
233 ms 24636 KB
//In His Name
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
typedef pair<int, int> pii;
typedef pair<long long, int> pli;
typedef pair<long long, long long> pll;
#define F first
#define S second
#define pb push_back
#define bug(x) cout << "Ah shit , here we go again : " << x <<endl
#define all(x) x.begin() , x.end()
#define ceil(x,y) x/y + min(1ll,x%y)
const int maxn = 5e3 + 10, MOD = 1e9 + 7;
const ll INF = 1e18;

int n , d , m;
vector<int> v;
bool check(int mid){
    vector<int> s;
    for(int i : v) s.pb(i);
    int cnt = 1 , flag = 0;
    for(int i = 0 ; i < s.size(); i++){
        if(cnt - s[i] > d) return false;
        if(cnt < s[i]) flag = 0 , cnt++ ;
        flag++;
        if(flag == mid) flag = 0 , cnt++;

    }
    return true;
}

signed main(){
    ios_base::sync_with_stdio(false);

    cin >> n >> d >> m;
    for(int i = 1 ; i <= m ; i++){
        int x;
        cin >> x;
        v.pb(x);
    }
    sort(all(v));
    int l = 1 , r = 1e9;
    while(r - l > 1){
        int mid = (l+r) >> 1;
        if(check(mid)) r = mid;
        else l = mid;
    }
    cout << r;

}

Compilation message

jobs.cpp: In function 'bool check(long long int)':
jobs.cpp:24:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i = 0 ; i < s.size(); i++){
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3140 KB Output isn't correct
2 Incorrect 25 ms 3052 KB Output isn't correct
3 Incorrect 25 ms 3132 KB Output isn't correct
4 Incorrect 28 ms 3372 KB Output isn't correct
5 Incorrect 25 ms 3140 KB Output isn't correct
6 Incorrect 25 ms 3140 KB Output isn't correct
7 Incorrect 25 ms 3144 KB Output isn't correct
8 Incorrect 26 ms 3140 KB Output isn't correct
9 Incorrect 27 ms 3128 KB Unexpected end of file - int32 expected
10 Incorrect 35 ms 3140 KB Unexpected end of file - int32 expected
11 Incorrect 32 ms 3312 KB Unexpected end of file - int32 expected
12 Incorrect 57 ms 5812 KB Unexpected end of file - int32 expected
13 Incorrect 95 ms 10696 KB Unexpected end of file - int32 expected
14 Incorrect 118 ms 12224 KB Unexpected end of file - int32 expected
15 Incorrect 134 ms 12540 KB Unexpected end of file - int32 expected
16 Incorrect 188 ms 20756 KB Unexpected end of file - int32 expected
17 Incorrect 219 ms 21588 KB Unexpected end of file - int32 expected
18 Incorrect 224 ms 24636 KB Unexpected end of file - int32 expected
19 Incorrect 233 ms 23512 KB Unexpected end of file - int32 expected
20 Incorrect 215 ms 22888 KB Unexpected end of file - int32 expected