# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23499 | rubabredwan | Skyscraper (JOI16_skyscraper) | C++14 | 303 ms | 348272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Bismillahir Rahmanir Rahim */
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int L = 1005;
const long long mod = 1e9 + 7;
long long dp[N][L][N][2][2];
int n, l, a[N];
long long recur(int at, int sum, int tot, int lf, int rf){
int fuk = sum + ((a[at] - a[at-1]) * (lf + rf + tot * 2));
if(fuk > l || tot < 0) return 0;
if(at == n) return (tot == 0);
if(dp[at][sum][tot][lf][rf] != -1) return dp[at][sum][tot][lf][rf];
long long ret = 0;
ret += recur(at+1, fuk, tot, 1, rf);
ret += recur(at+1, fuk, tot-1, 1, rf) * tot;
ret += recur(at+1, fuk, tot, lf, 1);
ret += recur(at+1, fuk, tot-1, lf, 1) * tot;
ret += recur(at+1, fuk, tot, lf, rf) * tot * 2;
ret += recur(at+1, fuk, tot-1, lf, rf) * tot * (tot - 1);
ret += recur(at+1, fuk, tot+1, lf, rf);
return dp[at][sum][tot][lf][rf] = ret % mod;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |