제출 #637809

#제출 시각아이디문제언어결과실행 시간메모리
637809beaconmcJob Scheduling (CEOI12_jobs)C++14
15 / 100
273 ms46188 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
using namespace std;
using namespace __gnu_pbds;

#define FOR(i, x, y) for(ll i=(x); i<(y); i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
ll temp;
ll n,d,m;
ll lis[1000001];
vector<vector<ll>> sus(1000001);

bool check(ll x){
	ll cur = 0;
	FOR(i,0,n){
		cur += lis[i];
		cur -= x;
		if (cur >= x*d){
			return false;
		}
	}
	return true;
}

void ans(ll x){
	vector<ll> realsus;
	FOR(i,0,n){
		for (auto&j : sus[i]){
			realsus.push_back(j);
		}
	}
	reverse(realsus.begin(), realsus.end());

	FOR(i,0,n){
		if (x > realsus.size()){
			x = realsus.size();
		}
		FOR(j,0,x){
			ll amog = realsus[realsus.size()-1];
			realsus.pop_back();
			cout << amog << " ";
		}
		cout << 0<<"\n";
	}
}

int main(){
	cin >> n >> d >> m;

	FOR(i,0,m){
		cin >> temp;
		lis[temp-1] += 1;
		sus[temp-1].push_back(i+1);
	}

	ll lo = 0;
	ll hi = 1000001;
	while (lo<hi){
		ll mid = (lo+hi)/2;
		if (check(mid)){
			hi = mid;
		}else{
			lo = mid+1;
		}
	}
	cout << lo << "\n";
	ans(lo);

	

}

컴파일 시 표준 에러 (stderr) 메시지

jobs.cpp: In function 'void ans(ll)':
jobs.cpp:40:9: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   if (x > realsus.size()){
      |       ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...