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>
#define se second
#define fi first
const int MOD=1000000007;
using namespace std;
int dp[501];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int p[n+1];
p[0]=0;
for (int i=1; i<=n; i++) {
int l,r;
cin >> l >> r;
p[i]=r;
}
for (int i=1; i<=n; i++) {
for (int k=1; k<i; k++)
if (p[i]>p[k])
dp[i]=dp[i]+dp[k]+1;
dp[i]++;
}
cout << dp[n];
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... |