DISH OF LIFE SOLUTION
Page 1 of 1
DISH OF LIFE SOLUTION
- Code:
import java.util.Scanner;
class dishlife {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int count=0;
int f1=0,f2=0;
int n=sc.nextInt();
int k=sc.nextInt();
int arr[]=new int[k];
for(int k1=1;k1<=n;k1++)
{
int g=sc.nextInt();
while(g-->0)
{
int l=sc.nextInt();
if(arr[l-1]==0)
{
arr[l-1]++;
count++;
}
}
if(count==k&&k1!=n)
{
f1=1;
}
if(count==k&&k1==n)
{
f2=1;
}
}
if(count!=k)
{
System.out.println("sad");
}
else if(f1==1){
System.out.println("some");
}
else if(f2==1)
{
System.out.println("all");
}
}
}
}
akarshsomani- Posts : 21
Join date : 2017-04-04
Similar topics
» SMARKET SOLUTION
» ROWSOLD SOLUTION
» CHEF AND DIGITS SOLUTION
» Similar Dishes Solution
» in ipl question.the test case 2nd is wrong.my solution is correct.
» ROWSOLD SOLUTION
» CHEF AND DIGITS SOLUTION
» Similar Dishes Solution
» in ipl question.the test case 2nd is wrong.my solution is correct.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|