문제
Note: The time limit for this problem is 3s, 1.5x the default. The memory limit for this problem is 512MB, twice the default.
Bessie is taking an -question true or false test (). For the -th question, she will gain points if she gets it correct, lose points if she gets it incorrect, or remain even if she does not answer it ().
Bessie knows all the answers because she is a smart cow, but worries that Elsie (who is administering the test) will retroactively change up to of the questions after the test such that Bessie does not get those questions correct.
Given () candidate values of (), determine the number of points Bessie can guarantee for each , given that she must answer at least questions.
입력
The first line contains and .
The next lines each contain and .
The next lines each contain a value of . No value of appears more than once.
출력
The answer for each on a separate line.
예제 입력 1
2 3
3 1
4 2
2
1
0
예제 출력 1
-3
1
7
점수
Inputs 2-4: Inputs 5-7: , Inputs 7-20: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인