Submission #1084522

# Submission time Handle Problem Language Result Execution time Memory
1084522 2024-09-06T11:04:24 Z rayan_bd Job Scheduling (CEOI12_jobs) C++17
0 / 100
206 ms 40612 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; 


#define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i]
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define br cout<<"\n"
#define pb push_back
#define nl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ret return
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())

const int mxN = 1e6 + 500;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;

vector<pair<ll,ll>> ar;
ll n,m,d,x;

bool good(ll mid){
	ll curr=m-1;
	for(ll day=n;day>=1&&curr>0;--day){
		for(ll j=0;j<mid&&curr>0;++j){
			if(ar[curr].first>day) return 0;
			--curr;
		}
	}
	return curr==0;
}

void solve(ll tc) {
    cin>>n>>d>>m;
    for(ll i=0;i<m;++i){
    	cin>>x;
    	ar.pb({x,i});
    }
    sort(all(ar));
    ll start=1,end=1e5+10,ans=INF;
    while(start<=end){
    	ll mid=start+(end-start)/2;
    	if(good(mid)){
    		ans=mid;
    		end=mid-1;
    	}else{
    		start=mid+1;
    	}
    }
    vector<vector<ll>> ans2(n+1);
    ll curr=m-1;
	for(ll day=n;day>=1&&curr>0;--day){
		for(ll j=0;j<ans&&curr>0;++j){
			ans2[day].pb(ar[curr].second+1);
			--curr;
		}
	}
	for(ll i=1;i<=n;++i){
		if(ans2[i].size()==0) cout<<0;
		for(auto itt:ans2[i]){
			cout<<itt<<" ";
		}br;
	}
} 

int main() {
    

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    	
    solve(69);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 4304 KB Output isn't correct
2 Incorrect 15 ms 4308 KB Output isn't correct
3 Incorrect 16 ms 4236 KB Output isn't correct
4 Incorrect 15 ms 4236 KB Output isn't correct
5 Incorrect 18 ms 4308 KB Output isn't correct
6 Incorrect 15 ms 4304 KB Output isn't correct
7 Incorrect 16 ms 4308 KB Output isn't correct
8 Incorrect 15 ms 4308 KB Output isn't correct
9 Incorrect 30 ms 8396 KB Output isn't correct
10 Incorrect 26 ms 8392 KB Output isn't correct
11 Incorrect 20 ms 3796 KB Output isn't correct
12 Incorrect 41 ms 7556 KB Expected EOLN
13 Incorrect 61 ms 12192 KB Output isn't correct
14 Incorrect 86 ms 16564 KB Expected EOLN
15 Incorrect 101 ms 17480 KB Output isn't correct
16 Incorrect 130 ms 21916 KB Output isn't correct
17 Incorrect 152 ms 29688 KB Output isn't correct
18 Incorrect 175 ms 31900 KB Expected EOLN
19 Runtime error 206 ms 40612 KB Memory limit exceeded
20 Incorrect 155 ms 29596 KB Output isn't correct