# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
898868 | 7again | Job Scheduling (CEOI12_jobs) | C++17 | 333 ms | 15780 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define FAST ios::sync_with_stdio(0); cin.tie(0)
#define f first
#define s second
using namespace std ;
const int N = 2e6 ;
int n , k , m ;
vector <pair <int , int>> p ;
bool slv(int x)
{
int u = 0 ;
for(int i = 1 ; i <= n ; i++)
for(int j = 0 ; j < x && u < m && p[u].f <= i ; j++)
if(i - p[u++].f > k)
return 0 ;
return (u == m) ;
}
main()
{
FAST ;
cin >> n >> k >> m ;
p.resize(m) ;
for(int i = 0 ; i < m ; i++)
{
cin >> p[i].f ;
p[i].s = i + 1 ;
}
sort(p.begin() , p.end()) ;
int l = 0 , r = N ;
while(l + 1 < r)
{
int h = l + (r - l) / 2 ;
if(slv(h))
r = h ;
else
l = h ;
}
cout << r << endl ;
int u = 0 ;
for(int i = 1 ; i <= n ; i++)
{
for(int j = 0 ; j < r && u < m && p[u].f <= i ; j++ , u++)
cout << p[u].s << " " ;
cout << 0 << endl ;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |