fork download
  1. #include <bits/stdc++.h>
  2. #define MOD 1000000007
  3. #define ll long long
  4. #define pii pair<int,int>
  5. #define pll pair<ll,ll>
  6. #define F first
  7. #define S second
  8. #define PB push_back
  9. #define MP make_pair
  10. #define MOD1 100000000
  11. #define REP(a,b) for (int i = a ; i < b ; i++)
  12.  
  13. using namespace std;
  14. pair<int,int> dp[1010][1010];
  15. int a[1010];
  16. int n;
  17. int mx;
  18. ll solve(int i , int j){
  19. if(i == n){
  20. if(dp[i][j].F == mx)
  21. return dp[i][j].S = dp[i][j].S + 1;
  22. else
  23. return dp[i].S;
  24. }
  25. if(dp[i][j].F != 0)
  26. return dp[i][j].S;
  27. ll sum1 = 0 , sum2 = 0 ;
  28. if(a[j] > a[i]){
  29. sum1 = 1 + solve(j,j+1);
  30. }
  31. ll sum2 = solve(i,j+1);
  32.  
  33. return dp[i][j].F = sum1+sum2;
  34. }
  35. int main(){
  36.  
  37. ios::sync_with_stdio(false) ;
  38.  
  39.  
  40.  
  41.  
  42. return 0 ;
  43. }
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘long long int solve(int, int)’:
prog.cpp:7:11: error: request for member ‘second’ in ‘dp[i]’, which is of non-class type ‘std::pair<int, int> [1010]’
 #define S second
           ^~~~~~
prog.cpp:23:26: note: in expansion of macro ‘S’
             return dp[i].S;
                          ^
prog.cpp:31:8: error: redeclaration of ‘long long int sum2’
     ll sum2 = solve(i,j+1);
        ^~~~
prog.cpp:27:19: note: ‘long long int sum2’ previously declared here
     ll sum1 = 0 , sum2 = 0 ;
                   ^~~~
stdout
Standard output is empty