2044: [USACO 2024 US Open Contest Silver] Problem 1. Bessie's Interview
题目描述
Bessie is looking for a new job! Fortunately, farmers are currently hiring and conducting interviews. Since jobs are highly competitive, the farmers have decided to number and interview cows in the order they applied. There are cows that applied before Bessie, so her number is ().
The interview process will go as follows. At time , farmer will start interviewing cow for each . Once a farmer finishes an interview, he will immediately begin interviewing the next cow in line. If multiple farmers finish at the same time, the next cow may choose to be interviewed by any of the available farmers, according to her preference.
For each , Bessie already knows that cow 's interview will take exactly minutes (). However, she doesn't know each cow's preference of farmers.
Since this job is very important to Bessie, she wants to carefully prepare for her interview. To do this, she needs to know when she will be interviewed and which farmers could potentially interview her. Help her find this information!
输入
The second line will contain integers .
输出
On the second line, a bit string of length , where the -th bit is if farmer could interview Bessie and otherwise.
样例输入
6 3
3 1 4159 2 6 5
样例输出
8
110
提示
There are cows aside from Bessie and farmers, and the interview process will go as follows:
- At time , farmer interviews cow , farmer interviews cow , and farmer interviews cow .
- At time , farmer finishes his interview with cow and starts interviewing cow .
-
At time , both farmer and farmer finish their interviews, and there are two possibilities:
- Farmer interviews cow and farmer interviews cow . In this case, farmer would finish his interview at time and start interviewing Bessie.
- Farmer interviews cow and farmer interviews cow . In this case, farmer would finish his interview at time and start interviewing Bessie.
Thus, Bessie's interview will begin at time , and she could be interviewed by either farmer or farmer .
SCORING:
- Inputs 2-3: No two farmers finish at the same time.
- Inputs 4-9:
- Inputs 10-21: No additional constraints.