This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 5e2 + 5;
#define ll long long
ll md = 1e9 + 7, a[N], b[N], dp[N];
int main () {
int n;
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i] >> b[i];
}
for (int i = 1; i <= n; ++i) {
dp[i] = 1;
for (int j = i - 1; j > 0; j--) {
if (a[i] > a[j]) {
dp[i] += dp[j];
dp[i] %= md;
}
}
}
ll sum = 0;
for (int i = 1; i <= n; ++i) {
sum += dp[i];
sum %= md;
}
cout << sum << "\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... |