#P9553. 「CROI · R1」浣熊的语言
「CROI · R1」浣熊的语言
Background
To prevent some magical brute-force solutions from passing, the time limit of this problem has been changed to .
He half-closes his eyes, reading the words on the sand.
Lines and phrases, recited day and night, his pen dancing like the wind; under the night, stars are scattered everywhere.
New ideas, about to emerge, so close yet slipping away; with a sigh, success falls short at the last moment.
She smiles in relief, stands up calmly, and lightly taps his back.
Then, in streaks of light, bear claws flutter; in the night wind, new words become clear.
“You did it……”
An ordinary midsummer night, profound words.
The effort of reciting, shimmering with starlight……
Problem Description
The little raccoon CleverRaccoon follows the raccoon word-forgetting curve and starts memorizing words from day .
There are words in total. Normally, the -th word will be learned for the first time on day .
Meanwhile, each word is scheduled for reviews. For the -th review, there is a review point , meaning that normally, each word will be reviewed days after its first learning. In other words, the time of the -th review for the -th word is day .
In addition, there are days with special situations. The -th special situation happens on day . On that day, CleverRaccoon forgets to memorize words, and any first-learning or review schedule that conflicts with that day will be postponed to the next day.
- If a word’s first-learning time is postponed to the next day, then the reviews of that word are arranged based on the postponed first-learning time.
- If a word’s current review time is postponed to the next day, it does not affect the subsequent review times of that word.
- If multiple learning or review events fall on the same day, then multiple learning or review actions must be done on that day.
CleverRaccoon wants to know: the number of days needed to finish learning and reviewing all words, the number of new words learned each day, and the number of words reviewed each day.
Input Format
The first line contains three integers , representing the total number of words to memorize, the number of special-situation days, and the number of reviews required for each word.
The second line contains integers , representing the first-learning time of each word. It is guaranteed that is non-decreasing.
The third line contains integers , representing the dates of special situations. It is guaranteed that is strictly increasing. In particular, if , then this line does not exist.
The fourth line contains integers , representing each review point for all words. It is guaranteed that is strictly increasing.
Output Format
The first line contains one integer, the number of days needed for CleverRaccoon to finish learning and reviewing all words.
Then there are lines. Each line contains two integers, representing the number of words newly learned and the number of words reviewed on that day.
5 0 2
1 1 1 2 3
1 2
5
3 0
1 3
1 4
0 2
0 1
5 1 2
1 1 1 2 3
1
1 2
5
0 0
4 0
1 4
0 5
0 1
5 1 3
1 2 3 4 5
3
1 2 3
8
1 0
1 1
0 0
2 4
1 3
0 3
0 3
0 1
Hint
Assume that the word indices in the input order are .
Sample Explanation #1
| Day | New word indices | Number of new words | Reviewed word indices | Number of reviewed words |
|---|---|---|---|---|
Sample Explanation #2
| Day | New word indices | Number of new words | Reviewed word indices | Number of reviewed words |
|---|---|---|---|---|
| (special) | ||||
Sample Explanation #3
| Day | New word indices | Number of new words | Reviewed word indices | Number of reviewed words |
|---|---|---|---|---|
| (special) | ||||
Constraints
This problem uses bundled Subtask testdata.
For of the data, it is guaranteed that , , , . It is guaranteed that is non-decreasing, and are strictly increasing.
| Subtask | Score | |||||
|---|---|---|---|---|---|---|
Translated by ChatGPT 5