当前位置:网站首页>[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;
}
边栏推荐
- Deb file installation
- Xinniuniu blind box wechat applet source code_ Support flow realization, with complete material pictures
- [JS download files through url]
- Summary of Aix storage management
- PLC Analog input analog conversion FB s_ ITR (Mitsubishi FX3U)
- cookie、session、tooken
- [eight sorts ④] merge sort, sort not based on comparison (count sort, cardinal sort, bucket sort)
- Otaku wallpaper Daquan wechat applet source code - with dynamic wallpaper to support a variety of traffic owners
- Node——添加压缩文件
- Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
Keepalived introduction and installation
[eight sorting ③] quick sorting (dynamic graph deduction Hoare method, digging method, front and back pointer method)
[bottom pop-up selector] uniapp picker component - scroll selector popped up at the bottom
使用 ES 实现疫情地图或者外卖点餐功能(含代码及数据)
JS -- image to base code, base to file object
2022拼多多详情/拼多多商品详情/拼多多sku详情
Geek DIY open source solution sharing - digital amplitude frequency equalization power amplifier design (practical embedded electronic design works, comprehensive practice of software and hardware)
Leetcode skimming: stack and queue 03 (valid parentheses)
DTL dephossite | prediction method of dephosphorylation sites based on Transfer Learning
Schrodinger's Japanese learning applet source code
随机推荐
@Valid参数校验不生效
JMeter做接口测试,如何提取登录Cookie
Intelligent operation and maintenance practice: banking business process and single transaction tracking
AIX存储管理之卷组属性的查看和修改(二)
Zak's latest "neural information transmission", with slides and videos
Deb file installation
Global and Chinese market of collaborative applications 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for power over Ethernet (POE) solutions 2022-2028: Research Report on technology, participants, trends, market size and share
Friends circle community program source code sharing
To meet the needs of consumers in technological upgrading, Angel water purifier's competitive way of "value war"
[CTF] bjdctf 2020 Bar _ Bacystack2
[conference resources] the Third International Conference on Automation Science and Engineering in 2022 (jcase 2022)
Schrodinger's Japanese learning applet source code
Global and Chinese markets of digital crosspoint switches and mux/demux 2022-2028: Research Report on technology, participants, trends, market size and share
LeetCode 0241.为运算表达式设计优先级 - DFS
Global and Chinese markets for distributed generation and energy storage in telecommunications networks 2022-2028: Research Report on technology, participants, trends, market size and share
Some understandings of graph convolution neural network r-gcn considering relations and some explanations of DGL official code
一名优秀的软件测试人员,需要掌握哪些技能?
You probably haven't noticed the very important testing strategy in your work
Viewing and modifying volume group attributes of Aix storage management (II)