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 mod = (int)1e9 + 7;
int a[501], b[501];
void solve(){
int n;
cin >> n;
for (int i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
long long dp[n];
long long ans = 0;
for (int i = 0; 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] %= mod;
}
ans += dp[i];
ans %= mod;
}
cout << ans << endl;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
# | 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... |