CF1913C.Game with Multiset
普及/提高-
通过率:0%

AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In this problem, you are initially given an empty multiset. You have to process two types of queries:
- ADD x — add an element equal to 2x to the multiset;
- GET w — say whether it is possible to take the sum of some subset of the current multiset and get a value equal to w .
输入格式
The first line contains one integer m ( 1≤m≤105 ) — the number of queries.
Then m lines follow, each of which contains two integers ti , vi , denoting the i -th query. If ti=1 , then the i -th query is ADD vi ( 0≤vi≤29 ). If ti=2 , then the i -th query is GET vi ( 0≤vi≤109 ).
输出格式
For each GET query, print YES if it is possible to choose a subset with sum equal to w , or NO if it is impossible.
输入输出样例
输入#1
5 1 0 1 0 1 0 2 3 2 4
输出#1
YES NO
输入#2
7 1 0 1 1 1 2 1 10 2 4 2 6 2 7
输出#2
YES YES YES