# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
902596 | Spade1 | Skyscraper (JOI16_skyscraper) | C++14 | 2097 ms | 47696 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>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll ll>
#define st first
#define nd second
#define pb push_back
using namespace std;
const int maxN = 1e2 + 2;
const int maxL = 1e3 + 2;
const int M = 1e9 + 7;
ll dp[maxN][10*maxL][3], tmp[maxN][10*maxL][3], a[maxN];
void solve() {
ll n, l; cin >> n >> l;
if (n == 1) {
cout << 1 << '\n';
return;
}
for (int i = 1; i <= n; ++i) cin >> a[i];
sort(a+1, a+n+1);
tmp[0][5*l][0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
for (int k = 0; k <= 10*l; ++k) {
if (k+2*a[i] <= 10*l) {
dp[j][k][0] = (dp[j][k][0] + j*tmp[j-1][k+2*a[i]][0]) % M;
dp[j][k][1] = (dp[j][k][1] + (j-1)*tmp[j-1][k+2*a[i]][1]) % M;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |