#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
int dp[503][503],a[503],b[503];
int n;const int mod=1e9+7;
int d(int x,int y)
{
if(x==n)return 1;
int &u=dp[x][y];
if(u!=-1)return u;
u=0;
u+=d(x+1,y);
if(a[x]>a[y])u+=d(x+1,x);
u%=mod;
return u;
}
int main()
{
cin>>n;
memset(dp,-1,sizeof dp);
for(int i=0;i<n;i++)
{
cin>>a[i]>>a[i];
}
ll re=0;
for(int i=0;i<n;i++)
{
re+=d(i,i);
re%=mod;
}cout<<re;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1228 KB |
Output is correct |
2 |
Correct |
3 ms |
1228 KB |
Output is correct |
3 |
Correct |
4 ms |
1228 KB |
Output is correct |
4 |
Correct |
3 ms |
1228 KB |
Output is correct |
5 |
Correct |
4 ms |
1324 KB |
Output is correct |
6 |
Correct |
4 ms |
1228 KB |
Output is correct |
7 |
Correct |
4 ms |
1228 KB |
Output is correct |
8 |
Correct |
4 ms |
1208 KB |
Output is correct |
9 |
Correct |
5 ms |
1228 KB |
Output is correct |
10 |
Correct |
5 ms |
1228 KB |
Output is correct |
11 |
Correct |
4 ms |
1228 KB |
Output is correct |
12 |
Correct |
4 ms |
1228 KB |
Output is correct |
13 |
Correct |
4 ms |
1228 KB |
Output is correct |
14 |
Correct |
4 ms |
1228 KB |
Output is correct |
15 |
Correct |
4 ms |
1228 KB |
Output is correct |
16 |
Correct |
4 ms |
1228 KB |
Output is correct |
17 |
Correct |
4 ms |
1228 KB |
Output is correct |
18 |
Correct |
4 ms |
1228 KB |
Output is correct |
19 |
Correct |
3 ms |
1228 KB |
Output is correct |
20 |
Correct |
5 ms |
1320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1228 KB |
Output is correct |
2 |
Correct |
3 ms |
1228 KB |
Output is correct |
3 |
Correct |
4 ms |
1228 KB |
Output is correct |
4 |
Correct |
3 ms |
1228 KB |
Output is correct |
5 |
Correct |
4 ms |
1324 KB |
Output is correct |
6 |
Correct |
4 ms |
1228 KB |
Output is correct |
7 |
Correct |
4 ms |
1228 KB |
Output is correct |
8 |
Correct |
4 ms |
1208 KB |
Output is correct |
9 |
Correct |
5 ms |
1228 KB |
Output is correct |
10 |
Correct |
5 ms |
1228 KB |
Output is correct |
11 |
Correct |
4 ms |
1228 KB |
Output is correct |
12 |
Correct |
4 ms |
1228 KB |
Output is correct |
13 |
Correct |
4 ms |
1228 KB |
Output is correct |
14 |
Correct |
4 ms |
1228 KB |
Output is correct |
15 |
Correct |
4 ms |
1228 KB |
Output is correct |
16 |
Correct |
4 ms |
1228 KB |
Output is correct |
17 |
Correct |
4 ms |
1228 KB |
Output is correct |
18 |
Correct |
4 ms |
1228 KB |
Output is correct |
19 |
Correct |
3 ms |
1228 KB |
Output is correct |
20 |
Correct |
5 ms |
1320 KB |
Output is correct |
21 |
Incorrect |
3 ms |
1324 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1228 KB |
Output is correct |
2 |
Correct |
3 ms |
1228 KB |
Output is correct |
3 |
Correct |
4 ms |
1228 KB |
Output is correct |
4 |
Correct |
3 ms |
1228 KB |
Output is correct |
5 |
Correct |
4 ms |
1324 KB |
Output is correct |
6 |
Correct |
4 ms |
1228 KB |
Output is correct |
7 |
Correct |
4 ms |
1228 KB |
Output is correct |
8 |
Correct |
4 ms |
1208 KB |
Output is correct |
9 |
Correct |
5 ms |
1228 KB |
Output is correct |
10 |
Correct |
5 ms |
1228 KB |
Output is correct |
11 |
Correct |
4 ms |
1228 KB |
Output is correct |
12 |
Correct |
4 ms |
1228 KB |
Output is correct |
13 |
Correct |
4 ms |
1228 KB |
Output is correct |
14 |
Correct |
4 ms |
1228 KB |
Output is correct |
15 |
Correct |
4 ms |
1228 KB |
Output is correct |
16 |
Correct |
4 ms |
1228 KB |
Output is correct |
17 |
Correct |
4 ms |
1228 KB |
Output is correct |
18 |
Correct |
4 ms |
1228 KB |
Output is correct |
19 |
Correct |
3 ms |
1228 KB |
Output is correct |
20 |
Correct |
5 ms |
1320 KB |
Output is correct |
21 |
Incorrect |
3 ms |
1324 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |