Election for a party in different phase and states
Sample TestCase 1
Input
phase=3
P[0]=2 P[1]=1 P[2]=0
state=2
S[0]=1 S[1]=2
similarly another ex:
3 3
3 2 1
1 2 2
Output
YES NO
Explanation
Test Case 1:
As per the theory, to form the government,party should win 2 seats in the first phase, 1 seat in second phase and 0 in last phase.party also needs to follow the number of wins in states column wise. There should be a single win in the seats of first state and 2 wins in the seats of second state.
My Attempt Code:
/*Enter your code here. Read input from STDIN. Print your output to STDOUT*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
for(int i=0;i<T;i++){
int P,S;
cin>>P;
cin>>S;