답안 #1109009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109009 2024-11-05T18:48:48 Z yazansh Job Scheduling (CEOI12_jobs) C++17
14 / 100
273 ms 44840 KB
/*************
  the author:     
  shimutski_zoro   
************ */
#include <bits/stdc++.h>
using namespace std;
#define yon(x) cout<<((x)?"YES":"NO");
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first 
#define ss second
#define em emplace_back
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define per(i,j,k) for(int i=k;i>=j;i--)
#define forp(x,y,a) for(auto &[x,y]:(a))
typedef long long  ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;
typedef vector<vl> vvl;
typedef vector<vpl> vvpl;
typedef vector<string> vs;
typedef deque<ll> dl;
const int mod=1e9+7;
ll inf =1e18+1;
const int M=1e6;
const int N=1e3+1; 
const ll dx[]={1,0,-1,0},dy[]={0,1,0,-1};
void solve(){
ll n,m,d;
cin>>n>>d>>m;
vpl a(m+10);
rep(i,0,m-1)cin>>a[i].ff , a[i].ss=i;
sort(all(a));
//forp(x,y,a)cout<<x<<" "<<y<<"\n";
vvl tmp(n+10);
 function<bool(ll)>check=[&](ll r)->bool{
  tmp=vvl (n+10);
ll cnt=0;
rep(i,1,n){
  rep(j,1,r){
    if(a[cnt].ff>i)
    break;
if(a[cnt].ff+d<i){
return 0;
}else{
  tmp[i-1].em(a[cnt].ss);
  cnt++;
}
if(cnt>=m)return 1;
  }

}
return 0;

 };
 vvl v(n+10);
 ll lo=1,hi=m+10;
 while(lo<=hi){
  ll mid= lo + (hi-lo)/2;
if(check(mid)){
  hi=mid-1;
  v=tmp;
}else{
  lo=mid+1;
}
 }
cout<<lo<<endl;
//vvl v(n+1);
rep(i,0,n-1){
  for(auto &it:v[i]){
    cout<<it+1<<" ";
  }
  cout<<0<<"\n";
}
}


signed main()
{
 
    ios_base::sync_with_stdio(NULL);
    cin.tie(nullptr);
    cout.tie(nullptr);
    #ifdef Usaco
    string f="herding";
    freopen((f+".in").c_str(),"r",stdin);
    freopen((f+".out").c_str(),"w",stdout);
    #endif
   int t = 1;
//cin >> t;
    while (t--)
    {
      solve();
    //  if(t>0)
      //cout<<endl;
    }
}
/*
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 5928 KB Output isn't correct
2 Incorrect 38 ms 5828 KB Output isn't correct
3 Incorrect 45 ms 6080 KB Output isn't correct
4 Incorrect 40 ms 5932 KB Output isn't correct
5 Incorrect 37 ms 5928 KB Output isn't correct
6 Incorrect 37 ms 5928 KB Output isn't correct
7 Incorrect 47 ms 5932 KB Output isn't correct
8 Incorrect 40 ms 5936 KB Output isn't correct
9 Partially correct 45 ms 13416 KB Partially correct
10 Partially correct 45 ms 14072 KB Partially correct
11 Partially correct 26 ms 4688 KB Partially correct
12 Partially correct 52 ms 8716 KB Partially correct
13 Partially correct 89 ms 14108 KB Partially correct
14 Incorrect 134 ms 19392 KB Output isn't correct
15 Partially correct 131 ms 21332 KB Partially correct
16 Partially correct 182 ms 26080 KB Partially correct
17 Runtime error 212 ms 33824 KB Memory limit exceeded
18 Runtime error 222 ms 34968 KB Memory limit exceeded
19 Runtime error 273 ms 44840 KB Memory limit exceeded
20 Runtime error 222 ms 33744 KB Memory limit exceeded