1 solutions

  • 1
    @ 2025-9-23 12:33:27
    #include <bits/stdc++.h>
    using namespace std;
    long long n, m, ans, x;
    char y;
    string t;
    int main()
    {
    	cin >> n >> m;
    	for (int i = 1;i <= n;i++)
    	{
    		cin >> t;
    		for (int j = 0;j < 5;j++)
    		{
    			if (t[j] == '0')
    			{
    				ans++;
    			}
    		}
    	}
    	for (int i = 1;i <= m;i++)
    	{
    		cin >> y >> x;
    		if (y == 'T')
    		{
    			if (ans + x > 5 * n)
    			{
    				cout << "No" << endl;
    			}
    			else
    			{
    				ans += x;
    				cout << "Yes" << endl;
    			}
    		}
    		else
    		{
    			if (ans >= x)
    			{
    				ans -= x;
    				cout << "Yes" << endl;
    			}
    			else
    			{
    				cout << "No" << endl;
    			}
    		}
    	}
    	return 0;
    }
    

    Information

    ID
    1032
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    14
    Accepted
    7
    Uploaded By