Submission #306957

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3069572020-09-26 15:11:56two_sidesSkyscraper (JOI16_skyscraper)C++17
100 / 100
362 ms173948 KiB
#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,
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...