# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44498 | arman_ferdous | Boat (APIO16_boat) | C++17 | 6 ms | 1996 KiB |
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 = 510, inf = 2e9, mod = 1e9+7;
int n;
pair<int,int> arr[510];
int dp[510][510];
int dp_9pts(int pos, int prev) {
if(pos < 0) return 1;
if(dp[pos][prev] != -1) return dp[pos][prev];
int ret = dp_9pts(pos-1,prev) % mod;
if(arr[pos].first < arr[prev].first) ret = (ret + dp_9pts(pos-1,pos))%mod;
return dp[pos][prev] = ret;
}
void pts9() {
memset(dp,-1,sizeof dp);
arr[n].first = inf;
printf("%d\n", dp_9pts(n-1,n) - 1);
}
int main() {
scanf("%d", &n);
for(int i = 0; i < n; i++)
scanf("%d %d", &arr[i].first, &arr[i].second);
pts9();
return 0;
}
Compilation message (stderr)
# | 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... |