#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long int lld;
#define MOD 1000000007
int main(){
int n;
cin>>n;
pair<lld,lld> arr[n];
for(int i=0;i<n;i++)cin>>arr[i].first>>arr[i].second;
lld DP[n];
lld ans=0;
for(int i=0;i<n;i++){
DP[i]=1;
for(int j=0;j<i;j++){
if(arr[j].first<arr[i].first){
DP[i]+=DP[j];
DP[i]%=MOD;
}
}
ans+=DP[i];
ans%=MOD;
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
356 KB |
Output is correct |
3 |
Correct |
4 ms |
476 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
712 KB |
Output is correct |
6 |
Correct |
3 ms |
712 KB |
Output is correct |
7 |
Correct |
3 ms |
728 KB |
Output is correct |
8 |
Correct |
4 ms |
788 KB |
Output is correct |
9 |
Correct |
4 ms |
808 KB |
Output is correct |
10 |
Correct |
4 ms |
816 KB |
Output is correct |
11 |
Correct |
4 ms |
844 KB |
Output is correct |
12 |
Correct |
4 ms |
856 KB |
Output is correct |
13 |
Correct |
4 ms |
868 KB |
Output is correct |
14 |
Correct |
4 ms |
880 KB |
Output is correct |
15 |
Correct |
5 ms |
952 KB |
Output is correct |
16 |
Correct |
5 ms |
964 KB |
Output is correct |
17 |
Correct |
3 ms |
976 KB |
Output is correct |
18 |
Correct |
4 ms |
988 KB |
Output is correct |
19 |
Correct |
4 ms |
1004 KB |
Output is correct |
20 |
Correct |
5 ms |
1016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
356 KB |
Output is correct |
3 |
Correct |
4 ms |
476 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
712 KB |
Output is correct |
6 |
Correct |
3 ms |
712 KB |
Output is correct |
7 |
Correct |
3 ms |
728 KB |
Output is correct |
8 |
Correct |
4 ms |
788 KB |
Output is correct |
9 |
Correct |
4 ms |
808 KB |
Output is correct |
10 |
Correct |
4 ms |
816 KB |
Output is correct |
11 |
Correct |
4 ms |
844 KB |
Output is correct |
12 |
Correct |
4 ms |
856 KB |
Output is correct |
13 |
Correct |
4 ms |
868 KB |
Output is correct |
14 |
Correct |
4 ms |
880 KB |
Output is correct |
15 |
Correct |
5 ms |
952 KB |
Output is correct |
16 |
Correct |
5 ms |
964 KB |
Output is correct |
17 |
Correct |
3 ms |
976 KB |
Output is correct |
18 |
Correct |
4 ms |
988 KB |
Output is correct |
19 |
Correct |
4 ms |
1004 KB |
Output is correct |
20 |
Correct |
5 ms |
1016 KB |
Output is correct |
21 |
Incorrect |
4 ms |
1016 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
356 KB |
Output is correct |
3 |
Correct |
4 ms |
476 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
712 KB |
Output is correct |
6 |
Correct |
3 ms |
712 KB |
Output is correct |
7 |
Correct |
3 ms |
728 KB |
Output is correct |
8 |
Correct |
4 ms |
788 KB |
Output is correct |
9 |
Correct |
4 ms |
808 KB |
Output is correct |
10 |
Correct |
4 ms |
816 KB |
Output is correct |
11 |
Correct |
4 ms |
844 KB |
Output is correct |
12 |
Correct |
4 ms |
856 KB |
Output is correct |
13 |
Correct |
4 ms |
868 KB |
Output is correct |
14 |
Correct |
4 ms |
880 KB |
Output is correct |
15 |
Correct |
5 ms |
952 KB |
Output is correct |
16 |
Correct |
5 ms |
964 KB |
Output is correct |
17 |
Correct |
3 ms |
976 KB |
Output is correct |
18 |
Correct |
4 ms |
988 KB |
Output is correct |
19 |
Correct |
4 ms |
1004 KB |
Output is correct |
20 |
Correct |
5 ms |
1016 KB |
Output is correct |
21 |
Incorrect |
4 ms |
1016 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |