답안 #882164

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
882164 2023-12-02T18:04:59 Z Lollospadalaser Job Scheduling (CEOI12_jobs) C++17
15 / 100
192 ms 13652 KB
#ifdef LOCAL
//#include "librerie locali/debugging.h"
#else
#pragma GCC optimize("Ofast,unroll-loops")
#endif
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x) for (int i = 0; i < (x); i++)
#define reps(i,j,x) for(int i=(j);i<(x);i++)
#define repp(i,x) for(int i = 1; i <= (x); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define maxint numeric_limits<int>::max()
#define minint numeric_limits<int>::min()
#define maxll numeric_limits<ll>::max()
#define minll numeric_limits<ll>::min()
#define nl '\n'
#define f first 
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef array<int, 3> i3;
typedef array<ll, 3> ll3;
typedef array<int, 4> i4;
typedef array<ll, 4> ll4;
typedef vector<i3> vi3;
typedef vector<ll3> vll3;
typedef vector<i4> vi4;
typedef vector<ll4> vll4;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;


int nxt() {int x;cin >> x;return x;}
template <class T> void make_unique(T &arr) {sort(all(arr)); arr.resize(unique(all(arr)) - arr.begin());}
void print(){cout<<endl;} template <typename T, typename... Types> void print(T var1, Types... var2) {cout<<var1<<" ";print(var2...);}
template <typename T> T maxm(T var) {return var;} template <typename T, typename... Types> T maxm(T var1, Types... var2) {return max(var1,maxm(var2...));}
template <typename T> T minm(T var) {return var;} template <typename T, typename... Types> T minm(T var1, Types... var2) {return min(var1,minm(var2...));}
ll lpow(ll base, ll exp){ll result = 1;for (;;){if (exp & 1)result *= base;exp >>= 1;if (!exp)break;base *= base;}return result;}
int log2_floor(unsigned long long i) {return i ? __builtin_clzll(1) - __builtin_clzll(i) : 0;}
template <typename T> T maxv(vector<T> &var) {T maxi=numeric_limits<T>::min();for(auto x : var)maxi=max(maxi,x);return maxi;}
template <typename T> T minv(vector<T> &var) {T mini=numeric_limits<T>::max();for(auto x : var)mini=min(mini,x);return mini;}


void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	#ifdef LOCAL
	freopen("shuffle.in", "r", stdin);
	#endif
	//freopen("shuffle.out", "w", stdout);	
	int t=1;
	//cin>>t;
	rep(i,t)solve();
}

void solve(){
	int n,s,m;
	cin>>n>>s>>m;
	vpi arr(m);
	rep(i,m){
		cin>>arr[i].f;
		arr[i].s=i+1;
	}
	sort(all(arr));
	auto f = [&](int x){
		int cur = 1;
		bool ok = true;
		rep(i,m){
			int d = 0;
			if(arr[i].f+s<cur){
				ok=false;
				break;
			}
			while(d+i<m&&d<x&&arr[i+d].f<=cur)d++;
			i+=max(d-1,0);
			if(i+1<m)cur=max(cur+1,arr[i+1].f);
		}
		return ok;
	};
	int x = 0;
	for(int i = 1e9;i>0;i/=2){
		while(!f(x+i))x+=i;
	}
	x++;
	cout<<x<<nl;
	int cur = 1;
	rep(i,m){
		int d = 0;
		while(d+i<m&&d<x&&arr[i+d].f<=cur){
			cout<<arr[i+d].s<<" ";
			d++;
		}
		cout<<"0"<<nl;
		i+=max(d-1,0);
		if(i+1<m){
			cur++;
			while(cur<arr[i+1].f){
				cout<<0<<nl;
				cur++;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 1628 KB Unexpected end of file - int32 expected
2 Incorrect 15 ms 1628 KB Unexpected end of file - int32 expected
3 Incorrect 14 ms 1628 KB Unexpected end of file - int32 expected
4 Incorrect 14 ms 1624 KB Unexpected end of file - int32 expected
5 Incorrect 15 ms 1628 KB Unexpected end of file - int32 expected
6 Incorrect 14 ms 1672 KB Unexpected end of file - int32 expected
7 Incorrect 17 ms 1764 KB Unexpected end of file - int32 expected
8 Incorrect 15 ms 1628 KB Unexpected end of file - int32 expected
9 Incorrect 20 ms 1712 KB Unexpected end of file - int32 expected
10 Incorrect 21 ms 1756 KB Unexpected end of file - int32 expected
11 Incorrect 24 ms 1736 KB Unexpected end of file - int32 expected
12 Correct 46 ms 3156 KB Output is correct
13 Incorrect 63 ms 4608 KB Unexpected end of file - int32 expected
14 Correct 90 ms 6228 KB Output is correct
15 Correct 116 ms 7688 KB Output is correct
16 Incorrect 136 ms 9244 KB Unexpected end of file - int32 expected
17 Incorrect 168 ms 10576 KB Unexpected end of file - int32 expected
18 Incorrect 170 ms 12116 KB Unexpected end of file - int32 expected
19 Incorrect 192 ms 13652 KB Unexpected end of file - int32 expected
20 Incorrect 155 ms 10580 KB Unexpected end of file - int32 expected