TORONTO KIDS COMPUTER CLUB | PMCA Sunday 10:00 Practice -04.18
19260
post-template-default,single,single-post,postid-19260,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

PMCA Sunday 10:00 Practice -04.18

14 Apr PMCA Sunday 10:00 Practice -04.18

Question:
Plasmatic loves playing with playdoughs in his spare times. Currently, he has a collection of N playdoughs, and the ith playdough weighs ai grams for each i from 1 to N. However, he is too busy practicing for IOI. As a result, he doesn’t have much time to play with the playdoughs. Instead, he gives you Q operations that he wants you to do with his collection of playdoughs, and each operation can be one of the two:

    • 1 x: Find all playdoughs that weighs exactly x grams then split the playdough into ⌈x/2⌉(round down) and ⌊x/2⌋(round up).
    • 2 y: Find the number of playdoughs that weighs exactly y grams.

As a good friend of him, you want to print the answers for all of the queries in the form of 2 y. Do not disappoint him!

Input Specification
First line contains two integers N and Q separated by a space.
The next line contains N integers ai, the weight of each of his playdough originally.
The following Q lines each contains two space-separated integers, indicating a valid query.

Output Specification
Print the answer to each of the query of the second type, followed by a newline.

Sample Input
5 4
1 2 3 4 5
1 5
1 4
2 2
2 3

Sample Output
4
2
No Comments

Sorry, the comment form is closed at this time.