Submission #265121

# Submission time Handle Problem Language Result Execution time Memory
265121 2020-08-14T13:18:23 Z fadi57 Job Scheduling (CEOI12_jobs) C++14
0 / 100
1000 ms 46052 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 = 1; 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 48 ms 7404 KB Output isn't correct
2 Incorrect 52 ms 7360 KB Output isn't correct
3 Incorrect 55 ms 7400 KB Output isn't correct
4 Incorrect 51 ms 7404 KB Output isn't correct
5 Incorrect 54 ms 7404 KB Output isn't correct
6 Incorrect 54 ms 7408 KB Output isn't correct
7 Incorrect 47 ms 7404 KB Output isn't correct
8 Incorrect 46 ms 7412 KB Output isn't correct
9 Runtime error 59 ms 14188 KB Execution killed with signal 11
10 Runtime error 63 ms 14576 KB Execution killed with signal 11
11 Incorrect 66 ms 7804 KB Output isn't correct
12 Incorrect 133 ms 10224 KB Output isn't correct
13 Incorrect 189 ms 13312 KB Output isn't correct
14 Execution timed out 1092 ms 14220 KB Time limit exceeded
15 Incorrect 273 ms 16092 KB Output isn't correct
16 Incorrect 476 ms 21560 KB Output isn't correct
17 Incorrect 703 ms 29912 KB Output isn't correct
18 Incorrect 525 ms 23236 KB Output isn't correct
19 Runtime error 632 ms 46052 KB Execution killed with signal 11
20 Incorrect 658 ms 29972 KB Output isn't correct