제출 #1281488

#제출 시각아이디문제언어결과실행 시간메모리
1281488osserJob Scheduling (CEOI12_jobs)C++20
컴파일 에러
0 ms0 KiB
import sys
input = sys.stdin.readline

N, D, M = map(int, input().split())
jobs = list(map(int, input().split()))
for i in range(M):
    jobs[i] = (jobs[i], i+1)
jobs.sort()

def is_feasible(m):
    schedule = [[] for _ in range(N)]
    j = 0

    for day in range(1, N+1):
        for _ in range(m):
            if jobs[j][0] > day:
                break

            if jobs[j][0] + D >= day:
                schedule[day-1].append(jobs[j][1])
                j += 1
            else:
                return 0, schedule
            
            if j == M:
                return 1, schedule
            
    return 0, schedule
    
ans = []
l, r = 1, M
while l < r:
    mid = (l + r) // 2
    result = is_feasible(mid)

    if result[0]:
        r = mid
        ans = result[1]
    else:
        l = mid + 1

print(l)
for i in range(N):
    ans[i] += [0]
    print(*ans[i])

컴파일 시 표준 에러 (stderr) 메시지

jobs.cpp:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
jobs.cpp:1:1: note: C++20 'import' only available with '-fmodules-ts', which is not yet enabled with '-std=c++20'