Submission #265017

# Submission time Handle Problem Language Result Execution time Memory
265017 2020-08-14T12:23:33 Z fadi57 Job Scheduling (CEOI12_jobs) C++14
40 / 100
1000 ms 632 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

using namespace std;
const int mx=1000009;
int sum[mx];
int ans[mx];
int main() {
    int n,d,m;
    cin>>n>>d>>m;
    for(int i=0;i<m;i++){
        int x;cin>>x;
        sum[x]++;
        
    }
    //return 0;
    for(int i=1;i<=n;i++){
        if(sum[i]){
            
            multiset<pair<int,int>> q;
            for(int j=i;j<=i+d;j++){
                q.insert({ans[j],j});
            }
            while(sum[i]--){
                auto o=q.begin();
            int z=(*o).first;
           q.erase(q.find(*o));
           ans[(*o).second]++;
           z++;
           q.insert({z,(*o).second});
                
            }
        }
        
    }int anss=0;
     for(int i=1;i<=n;i++){
     anss=max(ans[i],anss);
    }
    cout<<anss<<endl;
     for (int i = 0; i < n; i++)
        cout << "0\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 52 ms 384 KB Output is correct
2 Correct 47 ms 376 KB Output is correct
3 Correct 50 ms 376 KB Output is correct
4 Correct 46 ms 376 KB Output is correct
5 Correct 47 ms 384 KB Output is correct
6 Correct 45 ms 376 KB Output is correct
7 Correct 46 ms 376 KB Output is correct
8 Correct 46 ms 376 KB Output is correct
9 Incorrect 47 ms 504 KB Output isn't correct
10 Incorrect 43 ms 504 KB Output isn't correct
11 Incorrect 49 ms 376 KB Output isn't correct
12 Incorrect 105 ms 376 KB Output isn't correct
13 Incorrect 146 ms 384 KB Output isn't correct
14 Execution timed out 1089 ms 632 KB Time limit exceeded
15 Incorrect 235 ms 376 KB Output isn't correct
16 Incorrect 332 ms 384 KB Output isn't correct
17 Incorrect 472 ms 412 KB Output isn't correct
18 Incorrect 377 ms 376 KB Output isn't correct
19 Incorrect 433 ms 504 KB Output isn't correct
20 Incorrect 482 ms 384 KB Output isn't correct