Advertisement
Saleh127

LO 1371

Nov 12th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. test
  11. {
  12. ll a[10000],b[10000],c,d,e,f,i,j,k=1000000007,l=1;
  13. cin>>c;
  14. for(i=1;i<=c;i++)
  15. {
  16. cin>>a[i];
  17. }
  18.  
  19. for(i=1;i<=c;i++)
  20. {
  21. cin>>b[i];
  22. }
  23.  
  24. sort(a+1,a+c+1);
  25. sort(b+1,b+c+1);
  26.  
  27. for(i=1;i<=c;i++)
  28. {
  29. f=0;
  30. for(j=1;j<=c;j++)
  31. {
  32. if(a[j]<=b[i])
  33. {
  34. f++;
  35. }
  36. else if(f==0)
  37. {
  38. l=0;
  39. break;
  40. }
  41. }
  42. l*=(f-i+1);
  43. l%=k;
  44. }
  45. printf("Case %lld: %lld\n",cs,l);
  46. }
  47.  
  48.  
  49. return 0;
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement