当前位置:网站首页>[dynamic planning] interval dp:p3205 Chorus
[dynamic planning] interval dp:p3205 Chorus
2022-07-02 00:57:00 【muse_ age】



Code :
Be careful
1. Fill in the form from small range to large range :
2. Take the mold after each addition
#include<iostream>
using namespace std;
int n;
int a[1001];
int dp[1001][1001][2];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
dp[i][i][0]=1;
}
for(int len=2;len<=n;len++){
for(int i=1;i+len-1<=n;i++){
int j=i+len-1;
dp[i][j][0]=(dp[i+1][j][0]*(a[i]<a[i+1])+dp[i+1][j][1]*(a[i]<a[j]))%19650827;
dp[i][j][1]=(dp[i][j-1][1]*(a[j]>a[j-1])+dp[i][j-1][0]*(a[j]>a[i]))%19650827;
}
}
cout<<(dp[1][n][1]+dp[1][n][0])%19650827;
}
边栏推荐
- [eight sorts ①] insert sort (direct insert sort, Hill sort)
- cookie、session、tooken
- AIX存储管理之逻辑卷的创建及属性的查看和修改
- [opencv450] hog+svm and hog+cascade for pedestrian detection
- Excel search and reference function
- Leetcode skimming: stack and queue 03 (valid parentheses)
- Picture puzzle wechat applet source code_ Support multi template production and traffic master
- Leetcode skimming: stack and queue 05 (inverse Polish expression evaluation)
- excel数据透视表
- [eight sorts ②] select sort (select sort, heap sort)
猜你喜欢

Tensorflow tensor convolution, input and convolution kernel dimension understanding

Leetcode skimming: binary tree 03 (post order traversal of binary tree)
![[wechat authorized login] the small program developed by uniapp realizes the function of obtaining wechat authorized login](/img/c1/23be4399119f42d85a7b86fc8a59fc.png)
[wechat authorized login] the small program developed by uniapp realizes the function of obtaining wechat authorized login

SSO single sign on implementation.

Common loss function of deep learning

Some understandings of graph convolution neural network r-gcn considering relations and some explanations of DGL official code

测试人进阶技能:单元测试报告应用指南

Export default the exported object cannot be deconstructed, and module Differences between exports

Leetcode skimming: stack and queue 02 (realizing stack with queue)

The new version of graphic network PDF will be released soon
随机推荐
Leetcode skimming: binary tree 02 (middle order traversal of binary tree)
Tensorflow tensor convolution, input and convolution kernel dimension understanding
Leetcode skimming: stack and queue 03 (valid parentheses)
Geek DIY open source solution sharing - digital amplitude frequency equalization power amplifier design (practical embedded electronic design works, comprehensive practice of software and hardware)
XMIND mind map
PLC Analog input analog conversion FB s_ ITR (Mitsubishi FX3U)
449 original code, complement code, inverse code
cookie、session、tooken
How to determine whether the current script is in the node environment or the browser environment?
Picture puzzle wechat applet source code_ Support multi template production and traffic master
Node -- egg creates a local file access interface
Schrodinger's Japanese learning applet source code
How to open an account for individual stock speculation? Is it safe?
Excel PivotTable
【八大排序④】归并排序、不基于比较的排序(计数排序、基数排序、桶排序)
Iclr2022 | spherenet and g-spherenet: autoregressive flow model for 3D molecular graph representation and molecular geometry generation
To meet the needs of consumers in technological upgrading, Angel water purifier's competitive way of "value war"
Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for food allergens and intolerance tests 2022-2028: Research Report on technology, participants, trends, market size and share
Node -- egg implements the interface of uploading files