답안 #1011912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011912 2024-07-01T10:57:06 Z DrStonee Job Scheduling (CEOI12_jobs) C++14
0 / 100
95 ms 23376 KB
// Wael Benslimene DrStonee

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;


const long long mod=1e9+7;
const long long MOD=998244353;
#define ll long long
#define endl '\n'
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define INF 1e18+5
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()


ll binpow(ll a,ll b){ll res=1;while(b>0){if(b&1)res=(res*a);a=((a)*(a));b/=2;}return res;}
ll gcd(ll a,ll b){return b==0 ? a:gcd(b,a%b);}
ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
 

const int N=1e5+1;

vector<int> v[N],a[N];

void solve()
{
    int n,d,m,curr=0;cin>>n>>d>>m;
    for(int i=1,x;i<=m;i++)
    {
        cin>>x;
        v[x].pb(i);
        curr=max(curr,((int)v[x].size()+d-1) / d);
    }
    int j=1;
    for(int i=1;i<=n;i++)
    {
        if(v[i].empty())continue;
        for(int x=i;x<=d+i;x++)
        {
            while(!v[i].empty() && (int)a[x].size() < curr)
            {
                a[x].pb(v[i].back());
                v[i].pop_back();
            }
        }
        j=i;
        while(!v[i].empty())
        {
            a[j].pb(v[i].back());
            v[i].pop_back();
            curr=max(curr,(int)a[j].size());
            j++;
            if(j>d+i)j=i;
        }
    }
    cout<<curr<<endl;
    for(int i=1;i<=n;i++)
    {
        for(auto x:a[i])
        {
            cout<<x<<" ";
        }
        cout<<0<<endl;
    }
}   


int main()
{
    FAST;
    
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 6752 KB Output isn't correct
2 Incorrect 11 ms 6864 KB Output isn't correct
3 Incorrect 11 ms 6824 KB Output isn't correct
4 Incorrect 12 ms 6964 KB Output isn't correct
5 Incorrect 11 ms 6752 KB Output isn't correct
6 Incorrect 11 ms 6788 KB Output isn't correct
7 Incorrect 13 ms 7004 KB Output isn't correct
8 Incorrect 11 ms 6752 KB Output isn't correct
9 Incorrect 15 ms 7260 KB Output isn't correct
10 Incorrect 15 ms 7256 KB Output isn't correct
11 Incorrect 12 ms 7004 KB Output isn't correct
12 Incorrect 21 ms 8960 KB Output isn't correct
13 Incorrect 33 ms 12368 KB Output isn't correct
14 Incorrect 76 ms 14672 KB Output isn't correct
15 Incorrect 67 ms 15620 KB Output isn't correct
16 Incorrect 75 ms 18256 KB Output isn't correct
17 Incorrect 88 ms 22868 KB Output isn't correct
18 Incorrect 95 ms 22168 KB Output isn't correct
19 Incorrect 95 ms 23376 KB Output isn't correct
20 Incorrect 95 ms 23168 KB Output isn't correct