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 chmax(x, v) x = max(x, v)
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define int long long
using namespace std;
const int N = 105, MOD = 1e9 + 7, INDEFINI = -1;
signed main(){
int nBoats;
cin >> nBoats;
vector<int> vals(nBoats);
for (int& val : vals){
cin >> val;
cin >> val;
}
int nVals = nBoats;
int dp[nVals];
dp[0] = 1;
int sum = 1;
for (int ind = 1; ind < nVals; ++ind){
dp[ind] = 1;
for (int j = 0; j < ind; ++j){
if (vals[j] < vals[ind])
dp[ind] = (dp[ind] + dp[j])%MOD;
}
sum = (sum + dp[ind])%MOD;
}
cout << sum << endl;
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... |