Submission #831893

# Submission time Handle Problem Language Result Execution time Memory
831893 2023-08-20T17:01:51 Z Darren0724 Job Scheduling (CEOI12_jobs) C++17
0 / 100
131 ms 16120 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define x first
#define y second
const int mod=1e9+7;


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,d,m;cin>>n>>d>>m;
    vector<int> v[n+d+1];
    for(int i=1;i<=m;i++){
        int p;cin>>p;
        v[p].push_back(i);
    }
    queue<int> q;
    int l=0,r=m;
    while(r-l>1){
        int mi=(l+r)>>1;
        bool flag=0;
        for(int i=1;i<=n+d;i++){
            for(int j=0;j<v[i].size();j++){
                q.push(i);
            }
            for(int j=0;j<mi;j++){
                if(q.size()==0){
                    break;
                }
                int p=q.front();
                flag|=(i>p+d);
                q.pop();
            }
        }
        if(q.size()||flag){
            l=mi;
        }
        else{
            r=mi;
        }
    }
    cout<<r<<endl;
    
    return 0;
}

Compilation message

jobs.cpp: In function 'int32_t main()':
jobs.cpp:24:26: 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 j=0;j<v[i].size();j++){
      |                         ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2500 KB Unexpected end of file - int32 expected
2 Incorrect 13 ms 2380 KB Unexpected end of file - int32 expected
3 Incorrect 13 ms 2468 KB Unexpected end of file - int32 expected
4 Incorrect 13 ms 2372 KB Unexpected end of file - int32 expected
5 Incorrect 12 ms 2500 KB Unexpected end of file - int32 expected
6 Incorrect 13 ms 2464 KB Unexpected end of file - int32 expected
7 Incorrect 13 ms 2472 KB Unexpected end of file - int32 expected
8 Incorrect 13 ms 2384 KB Unexpected end of file - int32 expected
9 Incorrect 19 ms 4152 KB Unexpected end of file - int32 expected
10 Incorrect 19 ms 4260 KB Unexpected end of file - int32 expected
11 Incorrect 17 ms 1852 KB Output isn't correct
12 Incorrect 27 ms 3168 KB Unexpected end of file - int32 expected
13 Incorrect 38 ms 5876 KB Output isn't correct
14 Incorrect 73 ms 9340 KB Output isn't correct
15 Incorrect 83 ms 8372 KB Output isn't correct
16 Incorrect 99 ms 12928 KB Output isn't correct
17 Incorrect 118 ms 16120 KB Output isn't correct
18 Incorrect 106 ms 12428 KB Unexpected end of file - int32 expected
19 Incorrect 131 ms 14924 KB Unexpected end of file - int32 expected
20 Incorrect 115 ms 16116 KB Output isn't correct