Angry Professor

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n,k,cnt=0;
        cin >> n >> k;
        bool f=false;
        while(n--)
        {
            int x;
            cin >> x;
            if(x <= 0)
            {
                cnt++;
            }

            if(cnt >= k)
            {
                f=true;
            }
        }

        if(f)
        {
            cout << "NO\n";
        }
        else
        {
            cout << "YES\n";
        }
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number