# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
601714 | 1bin | Skyscraper (JOI16_skyscraper) | C++14 | 198 ms | 121004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const ll mod = 1e9 + 7;
ll n, mx, dp[105][105][1005][5], h[101];
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> mx;
for(int i = 1; i <= n; i++) cin >> h[i];
if(n == 1){
cout << "1"; return 0;
}
sort(h + 1, h + n + 1);
dp[0][0][0][0] = 1; h[n + 1] = 10000;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= i; j++)
for(int kk = 0; kk <= mx; kk++)
for(int l = 0; l < 3; l++){
int d = (2 * j - l) * (h[i + 1] - h[i]);
int k = kk + d;
if(k > mx) continue;
if(j > l) dp[i][j][k][l] += (j - l) * dp[i - 1][j - 1][kk][l];
dp[i][j][k][l] += (2 * j - l) * dp[i - 1][j][kk][l];
dp[i][j][k][l] += j * dp[i - 1][j + 1][kk][l];
if(l) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |