# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
591332 | YassineBenYounes | Job Scheduling (CEOI12_jobs) | C++17 | 364 ms | 13632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
ID: Yassine BenYounes
TASK: maxcross
LANG: C++
*/
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD)
ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);} // least common multiple (PPCM)
ll modd(ll x, ll n){while(x < 0){x += n;}return (x % n);} // modulo for negative numbers
#define endl "\n"
#define ss second
#define ff first
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define vi vector<int>
#define vii vector<pair<int,int>>
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vdd vector<pdd>
#define speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int mx = 2*1e5 + 9;
const ll mod = 1e9+7;
const ll inf = 1e15;
int n;int d;int m;
vii v;
bool f(int t){
int day = 1;
for(int i = 1; i <= m;i++){
if(day - v[i].ff > t)return 0;
if(i % t == 0)day++;
}
return 1;
}
int solve(){
int low = 1;
int high = 1e9 + 9;
int ans = 0;
while(low <= high){
ll mid = low + (high - low) / 2;
if(f(mid)){
ans = mid;
high = mid-1;
}
else{
low = mid+1;
}
}
return ans;
}
int main(){
speed;
cin >> n >> d >> m;
v.pb({0, 0});
for(int i = 0; i < m;i++){
int x;cin >> x;
v.pb({x, i+1});
}
sort(all(v));
int x = solve();
cout << x << endl;
for(int i = 1; i <= m;i++){
cout << v[i].ss << " ";
if(i % x == 0)cout << "0" << endl;
}
}
/*
NEVER GIVE UP!
DOING SMTHNG IS BETTER THAN DOING NTHNG!!!
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |