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

#BS0000341. Chuẩn bị kỳ thi (Preparing for the Contest)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Chuẩn bị kỳ thi (Preparing for the Contest)

Preparing for the Contest

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A judging system has mm independent bugs of difficulty aja_j. Student ii has ability bib_i and charges cic_i passes once if hired, regardless of workload. A student can fix at most one bug per day and only if aj≤bia_j\le b_i. Students work in parallel. With total budget ss, find a schedule minimizing the number of days, or report impossibility.

Input

First line: n,m,sn,m,s. Second line: mm difficulties aja_j. Third line: nn abilities bib_i. Fourth line: nn costs cic_i. Both students and bugs are numbered from 1.

Output

Print NO if no feasible schedule exists. Otherwise print YES and mm student indices on the next line, in original bug order. The assignment must minimize the number of days within budget. Any optimal assignment is accepted.

Subtask

  • Subtask 1 (20 points): 1≤n,m≤61\le n,m\le6; 0≤s≤1090\le s\le10^9; 1≤aj,bi≤1091\le a_j,b_i\le10^9; 0≤ci≤1090\le c_i\le10^9.
  • Subtask 2 (30 points): 1≤n,m≤1051\le n,m\le10^5; 0≤s≤1090\le s\le10^9; 1≤aj,bi≤1091\le a_j,b_i\le10^9; 0≤ci≤1090\le c_i\le10^9. b1=⋯=bnb_1=\cdots=b_n.
  • Subtask 3 (50 points): 1≤n,m≤1051\le n,m\le10^5; 0≤s≤1090\le s\le10^9; 1≤aj,bi≤1091\le a_j,b_i\le10^9; 0≤ci≤1090\le c_i\le10^9.

Examples

Input 1

3 4 9
1 3 1 2
2 1 3
4 3 6

Output 1

YES
2 3 2 3

Explanation

Student 2 handles two difficulty-1 bugs and student 3 handles difficulties 3 and 2. Cost is 9 and completion takes two days. One day would require four students.

Input 2

3 4 5
1 3 1 2
2 1 3
5 3 6

Output 2

NO

Explanation

Only student 3 can fix difficulty 3, but the cost 6 exceeds the budget.