PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000102. Xếp các tòa tháp Phượng Hoàng (Phoenix and Towers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xếp các tòa tháp Phượng Hoàng (Phoenix and Towers)

Phoenix and Towers

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

You have nn blocks of heights hih_i and must build mm nonempty towers using every block once. Tower height is the sum of its blocks. Assign every block so the difference between the tallest and shortest tower is at most xx. It is guaranteed that 1≤hi≤x1\le h_i\le x and m≤nm\le n. Print YES and tower indices if possible; otherwise NO.

Input

Line 1 contains n,m,xn,m,x. Line 2 contains nn integers hih_i.

Output

Print YES followed by nn tower indices in [1,m][1,m] assigning each block, or NO if impossible. Any valid assignment is allowed.

Subtasks

  • Subtask 1 (20 points): 1≤m≤n≤121\le m\le n\le 12; 1≤x≤1041\le x\le10^4; 1≤hi≤x1\le h_i\le x for every ii.
  • Subtask 2 (30 points): 1≤m≤n≤15001\le m\le n\le 1500; 1≤x≤1041\le x\le10^4; 1≤hi≤x1\le h_i\le x for every ii.
  • Subtask 3 (50 points): 1≤m≤n≤1000001\le m\le n\le 100000; 1≤x≤1041\le x\le10^4; 1≤hi≤x1\le h_i\le x for every ii.

Examples

Input

4 2 3
1 2 3 1

Output

YES
1 2 1 2

Explanation

One valid assignment is 1,2,1,21,2,1,2 for the four blocks: tower heights are 1+3=41+3=4 and 2+1=32+1=3, with difference 1≤31\le3. Both towers are nonempty.