Submission #917989

# Submission time Handle Problem Language Result Execution time Memory
917989 2024-01-29T09:52:01 Z Aiperiii Job Scheduling (CEOI12_jobs) C++14
0 / 100
245 ms 38872 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
int ans=0;
void to_ternary(int n){
   if(n==0)return ;
   int x=n%3;
   ans+=x;
   n/=3;
   to_ternary(n);
}
signed main(){
   ios_base::sync_with_stdio();
   cin.tie(0);cout.tie(0);
   int n,d,m;
   cin>>n>>d>>m;
   vector <pair <int,int> > v;
   for(int i=1;i<=m;i++){
      int x;cin>>x;
      v.pb({x,i});
   }
   sort(all(v));
   
   int l=0;
   int r=10;
   while(l+1<r){
      int md=(l+r)/2;
      deque <int> day;
      for(auto x : v){
         day.pb(x.ff);
      }
      for(int i=1;i<=n;i++){
         int cnt=md;
         while(day.size()!=0 && day.front()>=i-d && day.front()<=i && cnt>0){
            day.pop_front();
            cnt--;
         }
      }
      if(day.size()==0)r=md;
      else l=md;
   }
   deque <int> day,ind;
   for(auto x : v){
      day.pb(x.ff);
      ind.pb(x.ss);
   }
   vector <vector <int> > ans(n+1);
   cout<<r<<"\n";
   for(int i=1;i<=n;i++){
      int cnt=r;
      while(day.size()!=0 && day.front()>=i-d && day.front()<=i && cnt>0){
         day.pop_front();
         ans[i].pb(ind.front());
         ind.pop_front();
         cnt--;
      }
      ans[i].pb(0);
   }
   for(int i=1;i<=n;i++){
      for(auto x : ans[i])cout<<x<<" ";
      cout<<"\n";
   }
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
 */
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4300 KB Output isn't correct
2 Incorrect 17 ms 4532 KB Output isn't correct
3 Incorrect 20 ms 4292 KB Output isn't correct
4 Incorrect 18 ms 4300 KB Output isn't correct
5 Incorrect 20 ms 4416 KB Output isn't correct
6 Incorrect 18 ms 4300 KB Output isn't correct
7 Incorrect 18 ms 4292 KB Output isn't correct
8 Incorrect 19 ms 4496 KB Output isn't correct
9 Incorrect 39 ms 9552 KB Output isn't correct
10 Incorrect 38 ms 9676 KB Output isn't correct
11 Incorrect 29 ms 4044 KB Output isn't correct
12 Incorrect 56 ms 7444 KB Output isn't correct
13 Incorrect 73 ms 11552 KB Output isn't correct
14 Incorrect 123 ms 16000 KB Output isn't correct
15 Incorrect 123 ms 18316 KB Output isn't correct
16 Incorrect 165 ms 23716 KB Output isn't correct
17 Incorrect 207 ms 28600 KB Output isn't correct
18 Incorrect 208 ms 31048 KB Output isn't correct
19 Runtime error 245 ms 38872 KB Memory limit exceeded
20 Incorrect 200 ms 26844 KB Output isn't correct