Submission #553687

# Submission time Handle Problem Language Result Execution time Memory
553687 2022-04-26T15:36:40 Z ala2 Boat (APIO16_boat) C++14
0 / 100
4 ms 2260 KB
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define B begin()
#define E end()

using namespace std;
int n;
int a[1001000];
int dp[505][505];
int f(int i,int last)
{
    if(dp[i][last]!=-1)
        return dp[i][last];
    if(i==n+1)
        return 1;
    int g=f(i+1,last);
    if(last==0)
    {
        g+=f(i+1,i);
    }
    else if(a[i]>a[last])
        g+=f(i+1,i);
    return dp[i][last]=g;
}
signed main()
{
    memset(dp,-1,sizeof dp);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        cin>>a[i];
    }
        cout<<f(1,0)<<endl;

}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -