#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pii pair<int, int>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, b, a) for (int i = b; i >= a; --i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
const int MAXN = 5e2+10;
const int MOD = 1e9+7;
int l[MAXN], r[MAXN], dp[MAXN];
int32_t main() {
ios_base::sync_with_stdio(0);cin.tie(nullptr);
int n;cin >> n;
rep(i,1,n) cin >> l[i] >> r[i];
int ans = 0LL;
rep(i,1,n) {
dp[i] = 1;
per(j,i-1,1) {
if(l[i] > l[j]) dp[i] = (dp[i]+dp[j])%MOD;
}
ans = (ans+dp[i])%MOD;
}
cout << ans << '\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |