#include <bits/stdc++.h>
using namespace std;
const int N=510;
const int M=1000000007;
int n,kq;
int a[N],b[N];
int f[N][N];
int main()
{
ios_base::sync_with_stdio(false),cin.tie(nullptr);
cin>>n;
f[0][0]=1;
for(int i=1;i<=n;++i) cin>>a[i]>>b[i];
for(int i=1;i<=n;++i) for(int j=0;j<i;++j)
{
if(a[j]<a[i]) f[i][i]=(f[i][i]+f[i-1][j])%M;
f[i][j]=(f[i][j]+f[i-1][j])%M;
}
for(int i=0;i<=n;++i) kq=(kq+f[n][i])%M;
cout<<(kq-1+M)%M;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1400 KB |
Output is correct |
2 |
Correct |
4 ms |
1400 KB |
Output is correct |
3 |
Correct |
4 ms |
1400 KB |
Output is correct |
4 |
Correct |
4 ms |
1400 KB |
Output is correct |
5 |
Correct |
4 ms |
1400 KB |
Output is correct |
6 |
Correct |
4 ms |
1400 KB |
Output is correct |
7 |
Correct |
4 ms |
1400 KB |
Output is correct |
8 |
Correct |
4 ms |
1436 KB |
Output is correct |
9 |
Correct |
4 ms |
1400 KB |
Output is correct |
10 |
Correct |
4 ms |
1300 KB |
Output is correct |
11 |
Correct |
4 ms |
1400 KB |
Output is correct |
12 |
Correct |
4 ms |
1404 KB |
Output is correct |
13 |
Correct |
3 ms |
1400 KB |
Output is correct |
14 |
Correct |
4 ms |
1400 KB |
Output is correct |
15 |
Correct |
4 ms |
1292 KB |
Output is correct |
16 |
Correct |
4 ms |
1400 KB |
Output is correct |
17 |
Correct |
3 ms |
1400 KB |
Output is correct |
18 |
Correct |
3 ms |
1400 KB |
Output is correct |
19 |
Correct |
3 ms |
1400 KB |
Output is correct |
20 |
Correct |
3 ms |
1400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1400 KB |
Output is correct |
2 |
Correct |
4 ms |
1400 KB |
Output is correct |
3 |
Correct |
4 ms |
1400 KB |
Output is correct |
4 |
Correct |
4 ms |
1400 KB |
Output is correct |
5 |
Correct |
4 ms |
1400 KB |
Output is correct |
6 |
Correct |
4 ms |
1400 KB |
Output is correct |
7 |
Correct |
4 ms |
1400 KB |
Output is correct |
8 |
Correct |
4 ms |
1436 KB |
Output is correct |
9 |
Correct |
4 ms |
1400 KB |
Output is correct |
10 |
Correct |
4 ms |
1300 KB |
Output is correct |
11 |
Correct |
4 ms |
1400 KB |
Output is correct |
12 |
Correct |
4 ms |
1404 KB |
Output is correct |
13 |
Correct |
3 ms |
1400 KB |
Output is correct |
14 |
Correct |
4 ms |
1400 KB |
Output is correct |
15 |
Correct |
4 ms |
1292 KB |
Output is correct |
16 |
Correct |
4 ms |
1400 KB |
Output is correct |
17 |
Correct |
3 ms |
1400 KB |
Output is correct |
18 |
Correct |
3 ms |
1400 KB |
Output is correct |
19 |
Correct |
3 ms |
1400 KB |
Output is correct |
20 |
Correct |
3 ms |
1400 KB |
Output is correct |
21 |
Incorrect |
3 ms |
1400 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1400 KB |
Output is correct |
2 |
Correct |
4 ms |
1400 KB |
Output is correct |
3 |
Correct |
4 ms |
1400 KB |
Output is correct |
4 |
Correct |
4 ms |
1400 KB |
Output is correct |
5 |
Correct |
4 ms |
1400 KB |
Output is correct |
6 |
Correct |
4 ms |
1400 KB |
Output is correct |
7 |
Correct |
4 ms |
1400 KB |
Output is correct |
8 |
Correct |
4 ms |
1436 KB |
Output is correct |
9 |
Correct |
4 ms |
1400 KB |
Output is correct |
10 |
Correct |
4 ms |
1300 KB |
Output is correct |
11 |
Correct |
4 ms |
1400 KB |
Output is correct |
12 |
Correct |
4 ms |
1404 KB |
Output is correct |
13 |
Correct |
3 ms |
1400 KB |
Output is correct |
14 |
Correct |
4 ms |
1400 KB |
Output is correct |
15 |
Correct |
4 ms |
1292 KB |
Output is correct |
16 |
Correct |
4 ms |
1400 KB |
Output is correct |
17 |
Correct |
3 ms |
1400 KB |
Output is correct |
18 |
Correct |
3 ms |
1400 KB |
Output is correct |
19 |
Correct |
3 ms |
1400 KB |
Output is correct |
20 |
Correct |
3 ms |
1400 KB |
Output is correct |
21 |
Incorrect |
3 ms |
1400 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |