제출 #241227

#제출 시각아이디문제언어결과실행 시간메모리
241227AM1648Skyscraper (JOI16_skyscraper)C++17
15 / 100
9 ms768 KiB
/* be name khoda */ // #define long_enable #include <iostream> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <fstream> #include <set> #include <map> using namespace std; #ifdef long_enable typedef long long int ll; #else typedef int ll; #endif typedef pair<ll, ll> pii; typedef pair<pii, ll> ppi; typedef pair<ll, pii> pip; typedef vector<ll> vi; typedef vector<pii> vpii; #define forifrom(i, s, n) for (ll i = s; i < n; ++i) #define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i) #define fori(i, n) forifrom (i, 0, n) #define forir(i, n) forirto (i, n, 0) #define F first #define S second #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define smin(a, b) a = min(a, (b)) #define smax(a, b) a = max(a, (b)) #define debug(x) cout << #x << " -> " << (x) << endl #define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl #define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl #define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl #define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl #define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl const ll MOD = 1000000007; const ll INF = 2000000000; const long long BIG = 1446803456761533460LL; #define XL (x << 1) #define XR (XL | 1) #define MD ((l + r) >> 1) #define Add(a, b) a = ((a) + (1LL * b)) % MOD #define Mul(a, b) a = (1LL * (a) * (b)) % MOD // ----------------------------------------------------------------------- const ll maxn = 110; const ll maxa = 1010; ll N, L, A[maxn]; ll dp[maxn][maxn][maxa][3]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> N >> L; fori (i, N) cin >> A[i]; sort(A, A + N); dp[0][0][0][2] = 1; dp[0][0][0][1] = 2; fori (i, N - 1) { fori (j, (N + 1) / 2) { fori (k, L) { fori (c, 3) { ll v = dp[i][j][k][c]; ll kk = k + (j * 2 + c) * (A[i + 1] - A[i]); if (kk > L || v == 0) continue; Add(dp[i + 1][j + 1][kk][c], v * (j + c)); Add(dp[i + 1][j - 1][kk][c], v * j); Add(dp[i + 1][j ][kk][c], v * (j * 2 + c)); if (c) { Add(dp[i + 1][j ][kk][c - 1], v * c); Add(dp[i + 1][j + 1][kk][c - 1], v * c); } } } } } ll ans = 0; fori (k, L + 1) Add(ans, dp[N - 1][0][k][0]); cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...