当前位置:网站首页>Atcoder beginer contest 237 VP supplement
Atcoder beginer contest 237 VP supplement
2022-07-02 17:42:00 【sophilex】
Carelessness :
Given an undirected graph , The edge right between two points :
The edge weight from the higher point to the lower point is equal to the height difference
The edge weight from the lower point to the higher point is equal to negative twice the height difference
seek : Max in graph dis value
Ideas :
Just build the edge according to the meaning of the topic ;
But it has negative power , So in general dij no way .
After the game, we strengthened the data , So I ran away spfa,T rotten ...( But I think there is a buddy who really uses spfa Rushed over ...【 collapse 】)
The idea of the official solution is dij
consider “ potential ” Thought ( most ):
Preprocess the data , The edge weight from high to low is equal to 0, The distance from low point to high point is equal to the height difference (>=0)
Then it's all non negative side .
Run away dij After that, just restore the data back ,dis[i]=h[i]-h[1]+dist[i]
code:
Besides,
Carelessness :
Find the length of n, Each element is not greater than m Sequence , How many kinds of meet the following conditions :
The length of the longest ascending subsequence is exactly 3.
Ideas :
m Very small , Only 10, It's easy to think of violent enumeration for so long +dp
Might as well set i Represents the length of the current enumerated sequence ,k1 Indicates that the current sequence length is 1 Of LIS The minimum value of the last element of ,k2 Indicates that the current sequence length is 2 Of LIS The minimum value of the last element of ,k3 It means that the current sequence length is 3 Of LIS The minimum value of the last element of
that dp[i][k1][k2][k3] The number of schemes representing the corresponding situation .
Then enumerate one more at a time x, Yes x The size of can be classified and discussed .
See details code:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=1005;
const ll mod=998244353;
ll dp[N][12][12][12];
ll n,m;
int main()
{
cin>>n>>m;
dp[0][m+1][m+1][m+1]=1;
for(int i=1;i<=n;++i)
{
for(int k1=1;k1<=m+1;++k1)
{
for(int k2=1;k2<=m+1;++k2)
{
for(int k3=1;k3<=m+1;++k3)
{
for(int x=1;x<=m;++x)
{
if(x<=k1) dp[i][x][k2][k3]=(dp[i-1][k1][k2][k3]+dp[i][x][k2][k3])%mod;
else if(x<=k2) dp[i][k1][x][k3]=(dp[i-1][k1][k2][k3]+dp[i][k1][x][k3])%mod;
else if(x<=k3) dp[i][k1][k2][x]=(dp[i-1][k1][k2][k3]+dp[i][k1][k2][x])%mod;
}
}
}
}
}
ll ans=0;
for(int k1=1;k1<=m;++k1)
{
for(int k2=1;k2<=m;++k2)
{
for(int k3=1;k3<=m;++k3)
{
// cout<<dp[n][k1][k2][k3];
ans=(ans+dp[n][k1][k2][k3])%mod;
}
}
}
cout<<ans<<endl;
return 0;
}
边栏推荐
- traceroute命令讲解
- 求简单微分方程
- From collection to output: inventory those powerful knowledge management tools - inventory of excellent note taking software (4)
- Daily question - xiaolele changes the number
- 微信小程序 —— 上下浮动的箭头
- SAP commerce Cloud Architecture Overview
- Solution to the problem that the easycvr kernel of intelligent video analysis platform cannot be started as a service
- 常用SQL语句(完整范例)
- Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程
- 嵌入式 ~ 介绍
猜你喜欢
Alibaba Tianchi SQL learning notes - Day3
USB interface powered Bluetooth color light strip controller
Chrome browser quick access stackoverflow
Platform management background and business menu resource management: business permissions and menu resource management design
After meeting a full stack developer from Tencent, I saw what it means to be proficient in MySQL tuning
Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
嵌入式 ~ 介绍
freemarker+poi实现动态生成excel文件及解析excel文件
[非线性控制理论]7_High gain and High Frequency
【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
随机推荐
IPtables中SNAT、DNAT和MASQUERADE的含义
uva1169
ceph 原理
RK1126平台项目总结
每日一题——“水仙花数”
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
ROS knowledge points -- the difference between ros:: nodehandle N and NH ("~")
[非线性控制理论]7_High gain and High Frequency
海思Hi3798MV100机顶盒芯片介绍[通俗易懂]
[how is the network connected] Chapter 6 requests arrive at the server and respond to the client (end)
【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
VirtualLab基础实验教程-7.偏振(2)
Si446 usage record (I): basic data acquisition
如何给 SAP Spartacus Storefront 创建新的页面
Smart trash can (V) - light up OLED
easyAI笔记——机器学习
PCL知识点——体素化网格方法对点云进行下采样
From collection to output: inventory those powerful knowledge management tools - inventory of excellent note taking software (4)
Schoolbag novel multithreaded crawler [easy to understand]
【網絡是怎樣連接的】第六章 請求到達服務器以及響應給客戶端(完結)