#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
using namespace std;
const ll mod = 1e9+7;
int main(){
ll n;
cin>>n;
ll arr[n];
ll brr[n];
for(int i=0; i<n; i++){
cin>>arr[i];
cin>>brr[i];
}
ll dp[n];
dp[n-1] = 1;
for(int i=n-2; i>=0; i--){
ll a = arr[i];
// cout << a << " " << 25 << endl;
ll sum = 0;
for(int j=i+1; j<n; j++){
if(arr[j]>a){
sum = sum+dp[j];
// cout << arr[j] << " " << 30 << endl;
}
}
dp[i] = sum+1;
}
ll ans = 0;
for(int i=0; i<n; i++){
// cout << dp[i] << " ";
ans = (ans+dp[i])%mod;
}
// cout<<endl;
cout << ans%mod << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |