Advertisement
Saleh127

Live ar 6969

Dec 2nd, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 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 n,m,i,j,k,l;
  13. ll a[10000],b[10000],c=0,d=0,e,f;
  14.  
  15. cin>>n>>m;
  16. for(i=0;i<n-1;i++)
  17. {
  18. cin>>a[i];
  19. c+=a[i];
  20. }
  21. for(i=0;i<m;i++)
  22. {
  23. cin>>b[i];
  24. d+=b[i];
  25. }
  26. if(c%(n-1)==0) e=c/(n-1)-1;
  27. else e=c/(n-1);
  28.  
  29. f=d/m;
  30.  
  31. cout<<f+1<<" "<<e<<endl;
  32. }
  33.  
  34.  
  35.  
  36. return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement