Submission #265118

# Submission time Handle Problem Language Result Execution time Memory
265118 2020-08-14T13:17:20 Z fadi57 Job Scheduling (CEOI12_jobs) C++14
0 / 100
1000 ms 32004 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;
    vector<ll>v[100000];
     vector<ll>vv[100000];
    for(int i=0;i<m;i++){
        int x;cin>>x;
        sum[x]++;v[x].push_back(i+1);
        
    }
    //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});
            }int l=0;
            while(sum[i]--){
                auto o=q.begin();
            int z=(*o).first;
           q.erase(q.find(*o));
           ll xx=(*o).second;
           vv[xx].push_back(v[i][l]);
           ans[(*o).second]++;
           z++;
           q.insert({z,(*o).second});
                l++;
            }
        }
        
    }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++){
     
         for(int j=0;j<vv[i].size();j++){
             cout<<vv[i][j]<<" ";
         }   cout << "0\n";
     }
    return 0;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:47:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |          for(int j=0;j<vv[i].size();j++){
      |                      ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 7660 KB Output isn't correct
2 Incorrect 69 ms 7664 KB Output isn't correct
3 Incorrect 60 ms 7664 KB Output isn't correct
4 Incorrect 58 ms 7660 KB Output isn't correct
5 Incorrect 58 ms 7664 KB Output isn't correct
6 Incorrect 57 ms 7664 KB Output isn't correct
7 Incorrect 57 ms 7660 KB Output isn't correct
8 Incorrect 56 ms 7660 KB Output isn't correct
9 Incorrect 57 ms 8048 KB Output isn't correct
10 Incorrect 57 ms 8048 KB Output isn't correct
11 Incorrect 77 ms 8188 KB Output isn't correct
12 Incorrect 145 ms 11352 KB Output isn't correct
13 Incorrect 192 ms 15224 KB Output isn't correct
14 Execution timed out 1065 ms 15852 KB Time limit exceeded
15 Incorrect 327 ms 20700 KB Output isn't correct
16 Incorrect 448 ms 23544 KB Output isn't correct
17 Incorrect 692 ms 32004 KB Output isn't correct
18 Incorrect 507 ms 28396 KB Output isn't correct
19 Incorrect 565 ms 30064 KB Output isn't correct
20 Incorrect 620 ms 31992 KB Output isn't correct