fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main()
  5. {
  6. long long int n;
  7. long long int t,chef[1000],chef2[1500],boy[1500],boy2[1500],count=0,cplan,bcut,i,j;
  8. scanf(" %lld\n",&t);
  9. while(t--)
  10. {
  11. scanf(" %lld %lld %lld\n",&n,&cplan,&bcut);
  12.  
  13.  
  14. for(i=0;i<cplan;i++)
  15. {
  16. scanf(" %lld %lld\n",&chef[i],&chef2[i]);
  17.  
  18. }
  19. for(i=0;i<bcut;i++)
  20. {
  21. scanf(" %lld %lld\n",&boy[i],&boy2[i]);
  22.  
  23. }
  24. for(i=0;i<bcut;i++)
  25. {
  26. for(j=0;j<cplan;j++)
  27. {
  28. if(chef[j]==boy[i])
  29. count++;
  30. if(chef2[j]==boy2[i])
  31. count++;
  32. }
  33. if(count!=2)
  34. {
  35. printf("No\n");
  36. count=50;
  37. break;
  38. }
  39. count=0;
  40. }
  41. if(count!=50)
  42. printf("Yes\n");
  43. }
  44. return 0;}
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
Standard output is empty