# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
553692 |
2022-04-26T15:52:36 Z |
ala2 |
Boat (APIO16_boat) |
C++14 |
|
6 ms |
2316 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];
const int mod=1e9+7;
int f(int i,int last)
{
if(dp[i][last]!=-1)
return dp[i][last]%mod;
if(i==n+1)
return 1;
int g=f(i+1,last);
if(a[i]>a[last])
g+=f(i+1,i);
return dp[i][last]=g%mod;
}
signed main()
{
memset(dp,-1,sizeof dp);
cin>>n;
for(int i=1;i<=n;i++){
//a[i]=n-i;
cin>>a[i]>>a[i];
}
cout<<f(1,0)-1<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2260 KB |
Output is correct |
2 |
Correct |
4 ms |
2316 KB |
Output is correct |
3 |
Correct |
4 ms |
2312 KB |
Output is correct |
4 |
Correct |
3 ms |
2308 KB |
Output is correct |
5 |
Correct |
3 ms |
2260 KB |
Output is correct |
6 |
Correct |
3 ms |
2260 KB |
Output is correct |
7 |
Correct |
3 ms |
2308 KB |
Output is correct |
8 |
Correct |
3 ms |
2312 KB |
Output is correct |
9 |
Correct |
4 ms |
2304 KB |
Output is correct |
10 |
Correct |
4 ms |
2260 KB |
Output is correct |
11 |
Correct |
4 ms |
2260 KB |
Output is correct |
12 |
Correct |
4 ms |
2220 KB |
Output is correct |
13 |
Correct |
4 ms |
2260 KB |
Output is correct |
14 |
Correct |
6 ms |
2260 KB |
Output is correct |
15 |
Correct |
3 ms |
2260 KB |
Output is correct |
16 |
Correct |
3 ms |
2260 KB |
Output is correct |
17 |
Correct |
3 ms |
2308 KB |
Output is correct |
18 |
Correct |
3 ms |
2316 KB |
Output is correct |
19 |
Correct |
3 ms |
2312 KB |
Output is correct |
20 |
Correct |
4 ms |
2260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2260 KB |
Output is correct |
2 |
Correct |
4 ms |
2316 KB |
Output is correct |
3 |
Correct |
4 ms |
2312 KB |
Output is correct |
4 |
Correct |
3 ms |
2308 KB |
Output is correct |
5 |
Correct |
3 ms |
2260 KB |
Output is correct |
6 |
Correct |
3 ms |
2260 KB |
Output is correct |
7 |
Correct |
3 ms |
2308 KB |
Output is correct |
8 |
Correct |
3 ms |
2312 KB |
Output is correct |
9 |
Correct |
4 ms |
2304 KB |
Output is correct |
10 |
Correct |
4 ms |
2260 KB |
Output is correct |
11 |
Correct |
4 ms |
2260 KB |
Output is correct |
12 |
Correct |
4 ms |
2220 KB |
Output is correct |
13 |
Correct |
4 ms |
2260 KB |
Output is correct |
14 |
Correct |
6 ms |
2260 KB |
Output is correct |
15 |
Correct |
3 ms |
2260 KB |
Output is correct |
16 |
Correct |
3 ms |
2260 KB |
Output is correct |
17 |
Correct |
3 ms |
2308 KB |
Output is correct |
18 |
Correct |
3 ms |
2316 KB |
Output is correct |
19 |
Correct |
3 ms |
2312 KB |
Output is correct |
20 |
Correct |
4 ms |
2260 KB |
Output is correct |
21 |
Incorrect |
3 ms |
2260 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2260 KB |
Output is correct |
2 |
Correct |
4 ms |
2316 KB |
Output is correct |
3 |
Correct |
4 ms |
2312 KB |
Output is correct |
4 |
Correct |
3 ms |
2308 KB |
Output is correct |
5 |
Correct |
3 ms |
2260 KB |
Output is correct |
6 |
Correct |
3 ms |
2260 KB |
Output is correct |
7 |
Correct |
3 ms |
2308 KB |
Output is correct |
8 |
Correct |
3 ms |
2312 KB |
Output is correct |
9 |
Correct |
4 ms |
2304 KB |
Output is correct |
10 |
Correct |
4 ms |
2260 KB |
Output is correct |
11 |
Correct |
4 ms |
2260 KB |
Output is correct |
12 |
Correct |
4 ms |
2220 KB |
Output is correct |
13 |
Correct |
4 ms |
2260 KB |
Output is correct |
14 |
Correct |
6 ms |
2260 KB |
Output is correct |
15 |
Correct |
3 ms |
2260 KB |
Output is correct |
16 |
Correct |
3 ms |
2260 KB |
Output is correct |
17 |
Correct |
3 ms |
2308 KB |
Output is correct |
18 |
Correct |
3 ms |
2316 KB |
Output is correct |
19 |
Correct |
3 ms |
2312 KB |
Output is correct |
20 |
Correct |
4 ms |
2260 KB |
Output is correct |
21 |
Incorrect |
3 ms |
2260 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |