#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
ll mod = 1e9 + 7;
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
ll N;
cin>>N;
ll A[N], B[N];
for(ll i = 0;i < N;i++){
cin>>A[i]>>B[i];
}
ll dp[N];
memset(dp,0,sizeof(dp));
dp[0] = 1;
for(ll i = 1;i < N;i++){
dp[i] = 1;
for(ll j = 0;j < i;j++){
if(A[j] < A[i]){
dp[i] += dp[j];
dp[i] %= mod;
}
}
}
ll sum = 0;
for(ll i = 0;i < N;i++){
sum += dp[i];
sum %= mod;
}
cout<<sum<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
2 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
448 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
2 ms |
464 KB |
Output is correct |
13 |
Correct |
2 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
336 KB |
Output is correct |
16 |
Correct |
2 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
2 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
448 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
2 ms |
464 KB |
Output is correct |
13 |
Correct |
2 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
336 KB |
Output is correct |
16 |
Correct |
2 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
2 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
2 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
448 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
2 ms |
648 KB |
Output is correct |
12 |
Correct |
2 ms |
464 KB |
Output is correct |
13 |
Correct |
2 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
336 KB |
Output is correct |
16 |
Correct |
2 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |