Guest User

Untitled

a guest
May 2nd, 2019
276
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define tam 200000
  4. #define fi first
  5. #define pb push_back
  6. #define se second
  7.  
  8. #define FOR(i,n)for(int j=i;j<n;j++)
  9. typedef long long ll;
  10. typedef pair<ll,ll> ii;
  11. const ll INF=2e9;
  12. int dp[tam];
  13. const int C=4;
  14. int main()
  15. {
  16.  
  17. memset(dp,-1,sizeof dp);
  18. dp[0]=1;
  19. dp[1]=1;
  20. for (int i = 2; i < tam; ++i)
  21. {
  22. FOR(1,i)
  23. {
  24. dp[i]=max(dp[i],dp[j]+dp[i-j]+min(j,i-j)*C);
  25. }
  26. }
  27. cout<<dp[tam-1]<<endl;
  28.  
  29. }
RAW Paste Data