M - Multiprocessor Scheduler

Languages: C, C++, Java, Python, Kotlin
Time & Memory limits: (details)

Input

Output

Sample test(s)

Input
2 1 0 1 1 0 1 1
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
NO
--- Showing first 30 lines (click "Copy" to get full content) ---
Input
2 1 1 6 3 2 4 2
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
YES 2 1 1 2 1 4 6 1 1 2 4
--- Showing first 30 lines (click "Copy" to get full content) ---

Notes