大概是从我一年以来做过的最傻逼的一套题了。。

一个半小时打完三个程序三个暴力拍完以为自己AK了,开心地耍了两个小时。

结果T3要写高精,LL炸了后4个点,中间还有个点是啥都不选的,我没用0去更新又炸了一个点,成功把自己炸成一个二百五。

1.最小生成树模板题,前天那道题的——弱化+大概期望你去写个prim但是kruskal也可以过你可以两个拍一拍——版

几百年没写过prim了

 //Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#define Formylove return 0
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
const int N=;
typedef long long LL;
typedef double db;
using namespace std;
int n,a[N][N]; template<typename T>void read(T &x) {
char ch=getchar(); x=; T f=;
while(ch!='-'&&(ch<''||ch>'')) ch=getchar();
if(ch=='-') f=-,ch=getchar();
for(;ch>=''&&ch<='';ch=getchar()) x=x*+ch-''; x*=f;
} int vis[N];
LL ans,dis[N];
#define inf 1e18
void prim(int n) {
For(i,,n) dis[i]=inf;
dis[n]=;
For(i,,n) {
int x=;
For(j,,n) if(!vis[j]&&(!x||dis[j]<dis[x])) x=j;
if(!x) break;
vis[x]=;
ans+=dis[x];
dis[x]=;
For(j,,n) if(!vis[j]&&dis[j]>dis[x]+a[x][j])
dis[j]=dis[x]+a[x][j];
}
} #define ANS
int main() {
#ifdef ANS
freopen("newstart.in","r",stdin);
freopen("newstart.out","w",stdout);
#endif
read(n);
For(i,,n) {
read(a[i][n+]);
a[n+][i]=a[i][n+];
}
For(i,,n) For(j,,n) read(a[i][j]);
prim(n+);
printf("%lld\n",ans);
Formylove;
}
/*
4
5 4 4 3
0 2 2 2
2 0 3 3
2 3 0 4
2 3 4 0
*/

2、智障型dp

 //Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#define Formylove return 0
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
#define inf 1e9+7
const int N=;
typedef long long LL;
typedef double db;
using namespace std;
int n,m,a[N][N],b[N][N],f[N][N],sum1[N][N],sum2[N][N]; template<typename T>void read(T &x) {
char ch=getchar(); x=; T f=;
while(ch!='-'&&(ch<''||ch>'')) ch=getchar();
if(ch=='-') f=-,ch=getchar();
for(;ch>=''&&ch<='';ch=getchar()) x=x*+ch-''; x*=f;
} #define ANS
int main() {
#ifdef ANS
freopen("industry.in","r",stdin);
freopen("industry.out","w",stdout);
#endif
read(n); read(m);
For(i,,n) For(j,,m) read(a[i][j]);
For(i,,n) For(j,,m) read(b[i][j]);
For(i,,n)
For(j,,m) sum1[i][j]=sum1[i][j-]+a[i][j];
For(i,,n) {
int sum=;
For(j,,m) {
sum+=b[i][j];
sum2[i][j]=sum2[i-][j]+sum;
}
}
For(i,,n) {
int mx=-inf;
For(j,,m) {
mx=max(mx,f[i-][j]-sum2[i-][j]);
f[i][j]=max(f[i][j],mx+sum1[i][j]+sum2[i-][j]);
}
}
int ans=;
For(j,,m) ans=max(ans,f[n][j]+sum2[n][m]-sum2[n][j]);
printf("%d\n",ans);
Formylove;
}
/*
4 4
0 0 10 9
1 3 10 0
4 2 1 3
1 1 20 0
10 0 0 0
1 1 1 30
0 0 5 5
5 10 10 10
*/

3、会写高精的话比上面还智障,三方dp就可以得到70。如果再不那么智障一点点,贪心地把直接减血的塔放最后二方dp就可以过了。

我懒得写高精了,用__int128水过去了。。

 //Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#define Formylove return 0
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long LL;
typedef double db;
using namespace std;
__int128 f[][],n,r,g,b,T; template<typename T>void read(T &x) {
char ch=getchar(); x=; T f=;
while(ch!='-'&&(ch<''||ch>'')) ch=getchar();
if(ch=='-') f=-,ch=getchar();
for(;ch>=''&&ch<='';ch=getchar()) x=x*+ch-''; x*=f;
} void print(__int128 x){
if (x==) return;
if (x) print(x/);
putchar(x%+'');
} #define ANS
int main() {
#ifdef ANS
freopen("antbuster.in","r",stdin);
freopen("antbuster.out","w",stdout);
#endif
read(n); read(r); read(g); read(b); read(T);
__int128 ans=;
memset(f,,sizeof(f));
f[][]=;
For(i,,n)
For(j,,i) {
int gc=j,tc=i-j;
f[i][j]=max(f[i-][j-]+(T+tc*b)*(gc-)*g,f[i-][j]+(T+(tc-)*b)*gc*g);
ans=max(ans,f[i][j]+(n-i)*(T+tc*b)*(r+g*gc));
}
ans=max(ans,f[][]+n*T*r);
print(ans);
Formylove;
}
/*
1024 6545 65436 1146 6436
*/

暑假集训test-8-28的更多相关文章

  1. STL 入门 (17 暑假集训第一周)

    快速全排列的函数 头文件<algorithm> next_permutation(a,a+n) ---------------------------------------------- ...

  2. 2015UESTC 暑假集训总结

    day1: 考微观经济学去了…… day2: 一开始就看了看一道题目最短的B题,拍了半小时交了上去wa了 感觉自己一定是自己想错了,于是去拍大家都过的A题,十分钟拍完交上去就A了 然后B题写了一发暴力 ...

  3. 暑假集训Day2 互不侵犯(状压dp)

    这又是个状压dp (大型自闭现场) 题目大意: 在N*N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共8个格子. ...

  4. 暑假集训Day1 整数划分

    题目大意: 如何把一个正整数N(N长度<20)划分为M(M>=1)个部分,使这M个部分的乘积最大.N.M从键盘输入,输出最大值及一种划分方式. 输入格式: 第一行一个正整数T(T<= ...

  5. 2013ACM暑假集训总结-致将走上大三征途的我

    回想起这个暑假,从开始与雄鹰一起的纠结要不要进集训队,与吉吉博博组队参加地大邀请赛,害怕进不了集训队.当时激励我月份开始接触的,记得当时在弄运动会来着,然后就问了雄鹰一些输入输出的东西,怀着满心的期待 ...

  6. [补档]暑假集训D5总结

    %dalao 今天又有dalao来讲课,讲的是网络流 网络流--从入门到放弃:7-29dalao讲课笔记--https://hzoi-mafia.github.io/2017/07/29/27/   ...

  7. [补档]暑假集训D1总结

    归来 今天就这样回来了,虽然心里极其不想回来(暑假!@#的只有一天啊喂),但还是回来了,没办法,虽然不喜欢这个地方,但是机房却也是少数能给我安慰的地方,心再累,也没有办法了,不如好好集训= = %da ...

  8. 暑假集训(2)第七弹 -----今年暑假不AC(hdu2037)

    J - 今年暑假不AC Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:32768KB     64 ...

  9. [补档]暑假集训D6总结

    考试 不是爆零,胜似爆零= = 三道题,就拿了20分,根本没法玩好吧= = 本来以为打了道正解,打了道暴力,加上个特判分,应该不会死的太惨,然而--为啥我只有特判分啊- - 真的是惨. 讲完题觉得题是 ...

  10. [补档]暑假集训D4总结

    考试 爆零了,不开心,打了两道自己以为是正解的东西,打了两道样例骗分,结果发现并没有给样例分= =,自己以为的正解也打挂了,所以就很= = 但是没办法啊,自己弱也不能怪谁,考试这东西有时候也很玄学. ...

随机推荐

  1. flexbox布局一

    flexbox布局是一种新的css布局,flex是flexible的简写,所以flexbox就可以理解为可伸缩布局.而可伸缩性也是flexbox布局的亮点,至于如何可伸缩,看完下面的介绍大家应该就会有 ...

  2. leetcode-回溯②-难题

    题10: 回溯:另:动态规划复杂度更低 class Solution: def isMatch(self, s: str, p: str) -> bool: def helper(s,p): i ...

  3. python读取ini配置文件的示例代码(仅供参考)

    这篇文章主要介绍了python读取ini配置文件过程示范,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 安装 pip install configp ...

  4. Ubuntu下终端命令安装sublime

    Ubuntu下终端命令安装sublime出现软件包无法定位 sublime-text-install 且多次换源不成功 建议采用离线安装 安装教程如下 用Ubuntu上的浏览器下载一个 Sublime ...

  5. PHP FILTER_SANITIZE_NUMBER_FLOAT 过滤器

    定义和用法 FILTER_SANITIZE_NUMBER_FLOAT 过滤器删除浮点数中所有非法的字符. 该过滤器默认允许所有数字以及 + - Name: "number_float&quo ...

  6. JCF——List

    ArrayList LinkedList Vector

  7. [ZJOI2011]看电影(组合数学/打表+高精)

    Description 到了难得的假期,小白班上组织大家去看电影.但由于假期里看电影的人太多,很难做到让全班看上同一场电影,最后大家在一个偏僻的小胡同里找到了一家电影院.但这家电影院分配座位的方式很特 ...

  8. (转)阿里RocketMQ Quick Start

    转:http://blog.csdn.net/a19881029/article/details/34446629 RocketMQ单机支持1万以上的持久化队列,前提是足够的内存.硬盘空间,过期数据数 ...

  9. mongodb副本集(选举,节点设置,读写分离设置)

    1.相对于传统主从模式的优势 传统的主从模式,需要手工指定集群中的Master.如果Master发生故障,一般都是人工介入,指定新的Master.这个过程对于应用一般不是透明的,往往伴随着应用重新修改 ...

  10. Peer模式的多线程程序例子

    Peer模式的多线程程序例子 程序的模型大概是这样的.有一个master(),用来分发任务.有N个多线程的slave用来处理任务. 主程序里可以这样调用: 可以看出,上面这段程序还是依赖于Proces ...