Advertisement
om_namah_shivaay

tle_on_this

May 30th, 2021
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8. long t;
  9. cin>>t;
  10. while(t--)
  11. {
  12. long long n,k,f,summ,p=0;
  13. cin>>n>>k>>f;
  14. summ=f;
  15. long long a[f+2];
  16. memset(a,0,sizeof(a));
  17. // for(int i=0;i<f;i++)
  18. // cout<<a[i]<<" ";
  19. while(n--)
  20. {
  21. long long s,e;
  22. cin>>s>>e;
  23. for(long i=s;i<e;i++)
  24. {
  25. if(a[i]==0)
  26. {
  27. a[i]=1;
  28. p++;
  29. }
  30. }
  31. }
  32. summ-=p;
  33. //cout<<summ<<endl;
  34. // for(int i=0;i<f;i++)
  35. // cout<<a[i]<<" ";
  36. // cout<<endl;
  37. if(summ>=k)
  38. cout<<"YES\n";
  39. else
  40. cout<<"NO\n";
  41. }
  42. return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement