답안 #1113983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113983 2024-11-18T04:14:19 Z ezzzay Job Scheduling (CEOI12_jobs) C++14
10 / 100
436 ms 21044 KB
#include<bits/stdc++.h>
using namespace std;
#define itn long long
#define ff first
#define ss second
#define int long long
#define pb push_back
vector<pair<int,int>>v;
int n,d,m;
bool check(int mid){
    int j=0;
    for(int i=1;i<=n;i++){
        int p=mid;
        while(j<m and p>0){
            
            j++;
            p--;
            if(v[j].ff > i+d)break;
        }
    }
    return j==m;
}
void fun(int mid){
    int j=0;
    for(int i=1;i<=n;i++){
        int p=mid;
        while(j<m and p>0){
            
            cout<<v[j].ss<<" ";
            j++;
            p--;
            if(v[j].ff > i+d)break;
        }
        cout<<0<<endl;
    }
}
signed main(){
    cin>>n>>d>>m;
    for(int i=1;i<=m;i++){
        int x;
        cin>>x;
        v.pb({x,i});
    }
    sort(v.begin(),v.end());
    int lo=0,hi=1e9;
    while(hi>=lo){
        int mid=(hi+lo)/2;
        bool u=check(mid);
        if(u){
            hi=mid-1;
        }
        else{
            lo=mid+1;
        }
    }
    cout<<lo<<endl;
    fun(lo);
    
}
/*
8 2 12 
1 2 4 2 1 3 5 6 2 3 6 4
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 3524 KB Output isn't correct
2 Incorrect 40 ms 2616 KB Output isn't correct
3 Incorrect 37 ms 2936 KB Output isn't correct
4 Incorrect 37 ms 3008 KB Output isn't correct
5 Incorrect 37 ms 2564 KB Output isn't correct
6 Incorrect 38 ms 3000 KB Output isn't correct
7 Incorrect 37 ms 2704 KB Output isn't correct
8 Incorrect 37 ms 2548 KB Output isn't correct
9 Incorrect 174 ms 2744 KB Output isn't correct
10 Incorrect 169 ms 2744 KB Output isn't correct
11 Incorrect 32 ms 2668 KB Output isn't correct
12 Correct 68 ms 4908 KB Output is correct
13 Incorrect 95 ms 8628 KB Output isn't correct
14 Correct 146 ms 9372 KB Output is correct
15 Incorrect 151 ms 11544 KB Output isn't correct
16 Incorrect 212 ms 17820 KB Output isn't correct
17 Incorrect 267 ms 16796 KB Output isn't correct
18 Incorrect 264 ms 18384 KB Output isn't correct
19 Incorrect 436 ms 21044 KB Output isn't correct
20 Incorrect 253 ms 18204 KB Output isn't correct