답안 #1032228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032228 2024-07-23T13:39:08 Z EkinOnal Job Scheduling (CEOI12_jobs) C++17
0 / 100
184 ms 29268 KB
//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; using namespace __gnu_pbds;

#define MAX 300007    
#define pb push_back
#define mp make_pair 
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int>> 
const int mod = 1e9+7;
const int INF = 1e18;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
// myMap.begin()->first :  key  // myMap.begin()->second : value
int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;ans%=mod;a%=mod;b>>=1;}return ans%mod;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(int a,int b){return ((a%mod)*(b%mod)+mod)%mod;}
int sum(int a,int b){return ((a%mod)+(b%mod)+mod)%mod;}

void solve()
{
	int n,d,m; cin >> n >> d >> m;

	vpii v(m);
	for(int i=0;i<m;i++) {cin >> v[i].f;v[i].s=i;}
	sort(v.begin(),v.end());
	
	vi pre(n+5);
	for(int i=0;i<m;i++) pre[v[i].f+d]++;
	for(int i=1;i<=n;i++) pre[i]+=pre[i-1];
	
	int l=0,r=10000;
	while(l<=r){
		int mid=(l+r)>>1;

		bool flag=true;
		for(int i=1;i<=n;i++) if(pre[i]>i*mid) {flag=false;break;}

		if(flag) r=mid-1;
		else l=mid+1;
	}

	cout << l << endl;
	vi ans(m+2);
	for(int i=0;i<m;i++) ans[v[i].s]=i/l+1;
	
	for(int i=0;i<m;i++) cout << ans[i] << " ";
	
	
}	
 
 
int32_t main() {
//	freopen("island.in", "r", stdin);
//	freopen("island.out", "w", stdout);
	ios_base::sync_with_stdio(0);cin.tie(0);   

    int t=1;
//    cin >> t;
    while (t--) solve();
 
    return 0;
}



# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 3420 KB Output isn't correct
2 Incorrect 11 ms 3420 KB Output isn't correct
3 Incorrect 11 ms 3348 KB Output isn't correct
4 Incorrect 11 ms 3416 KB Output isn't correct
5 Incorrect 11 ms 3420 KB Output isn't correct
6 Incorrect 11 ms 3416 KB Output isn't correct
7 Incorrect 11 ms 3400 KB Output isn't correct
8 Incorrect 11 ms 3420 KB Output isn't correct
9 Incorrect 18 ms 3932 KB Unexpected end of file - int32 expected
10 Incorrect 18 ms 3932 KB Unexpected end of file - int32 expected
11 Incorrect 18 ms 3420 KB Unexpected end of file - int32 expected
12 Incorrect 36 ms 6660 KB Unexpected end of file - int32 expected
13 Incorrect 54 ms 9816 KB Unexpected end of file - int32 expected
14 Incorrect 75 ms 13648 KB Unexpected end of file - int32 expected
15 Incorrect 90 ms 15820 KB Output isn't correct
16 Incorrect 112 ms 20304 KB Unexpected end of file - int32 expected
17 Incorrect 130 ms 23684 KB Unexpected end of file - int32 expected
18 Incorrect 146 ms 25428 KB Unexpected end of file - int32 expected
19 Incorrect 184 ms 29268 KB Unexpected end of file - int32 expected
20 Incorrect 139 ms 23632 KB Unexpected end of file - int32 expected