# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30793 | cdemirer | Boat (APIO16_boat) | C++14 | 2000 ms | 361884 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;
typedef long long ll;
typedef pair<ll, ll> llp;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define MOD ((ll)1e9+7)
#define safeadd(x, y) ( ( ((ll)x % MOD) + ((ll)y % MOD) ) % MOD )
int N;
map<int, ll> dp[500];
int A[500], B[500];
ll func(int x, int s) {
s = max(s, A[x]-1);
s = min(s, B[x]);
//cerr << "called: " << x << " " << s << endl;
if (dp[x][s] != -1) return dp[x][s];
ll sum = 0;
if (x < N-1) sum = safeadd(sum, func(x+1, 0));
else sum = safeadd(sum, 1);
for (int i = s+1; i <= B[x]; i++) {
if (x < N-1) sum = safeadd(sum, func(x+1, i));
else sum = safeadd(sum, 1);
}
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... |