Saleh127

UVA 10440

Sep 9th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int tt; cin>>tt; while(tt--)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll n,t,m,i,j,k,l,ans;
  11.  
  12. test
  13. {
  14. cin>>n>>t>>m;
  15.  
  16. ll a[m+10];
  17.  
  18. for(i=1;i<=m;i++)
  19. {
  20. cin>>a[i];
  21. }
  22.  
  23. k=m%n;
  24.  
  25. if(k==0) k=n;
  26. ans=0;
  27.  
  28. for(i=k;i<=m;i+=n)
  29. {
  30. ans=max(ans,a[i])+(2*t);
  31. }
  32.  
  33. ///ans=a[m]+(2*t);
  34. l=(n+m-1)/n;
  35. cout<<ans-t<<" "<<l<<endl;
  36.  
  37. }
  38.  
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment