# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
306957 | two_sides | Skyscraper (JOI16_skyscraper) | C++17 | 362 ms | 173948 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;
using ll = long long;
const int L = 1005;
const int N = 105;
const int MOD = 1e9 + 7;
int madd(int x, int y) {
if ((x += y) >= MOD) x -= MOD;
return x;
}
int mmul(int x, int y) {
return ll(x) * y % MOD;
}
int n, l, dp[N][L][N][2][2], a[N];
int rec(int i, int tot,
int seg, int kl, int kr) {
int nxt = tot + (seg * 2 + kl
+ kr) * abs(a[i + 1] - a[i]);
if (nxt > l || seg < 0) return 0;
if (i == n - 1) return seg == 0;
int &res = dp[i][tot][seg][kl][kr];
if (~res) return res;
res = rec(i + 1, nxt, seg, 1, kr);
res = madd(res,
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |