# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
265121 | fadi57 | Job Scheduling (CEOI12_jobs) | C++14 | 1092 ms | 46052 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
using namespace std;
const int mx=1000009;
int sum[mx];
int ans[mx];
int main() {
int n,d,m;
cin>>n>>d>>m;
vector<ll>v[100000];
vector<ll>vv[100000];
for(int i=0;i<m;i++){
int x;cin>>x;
sum[x]++;v[x].push_back(i+1);
}
//return 0;
for(int i=1;i<=n;i++){
if(sum[i]){
multiset<pair<int,int>> q;
for(int j=i;j<=i+d;j++){
q.insert({ans[j],j});
}int l=0;
while(sum[i]--){
auto o=q.begin();
int z=(*o).first;
q.erase(q.find(*o));
ll xx=(*o).second;
vv[xx].push_back(v[i][l]);
ans[(*o).second]++;
z++;
q.insert({z,(*o).second});
l++;
}
}
}int anss=0;
for(int i=1;i<=n;i++){
anss=max(ans[i],anss);
}
cout<<anss<<endl;
for (int i = 1; i <= n; i++){
for(int j=0;j<vv[i].size();j++){
cout<<vv[i][j]<<" ";
} cout << "0\n";
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |