19-10-26-F
ZJ一下:
T1码了暴力但是并没有开出来身高的神奇性质……
T2打模拟,但是只摸了卅分
T3不会,码了一个测试点分治。10分
TJ一下:
T1。
发现身高范围在$[140,200]$时,直接去重跑$\text{dp}$就行了。
时间复杂度:$\Theta(V^2)$($V$为值域大小)
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 111111
#define K 22
#define LF double using namespace std; int pn,qn;
LF arr[N],ans;
LF dp[N][K];
inline LF p2(LF k){
return k*k;
}
int main(){
// freopen("queue.in" ,"r",stdin);\
freopen("queue.out","w",stdout);
scanf("%d%d",&pn,&qn);
for(int i=1;i<=pn;i++)
scanf("%lf",arr+i);
sort(arr+1,arr+pn+1);
pn=unique(arr+1,arr+pn+1)-arr-1;
for(int i=1;i<=pn;i++)
for(int j=1;j<=qn;j++)
dp[i][j]=1e10;
for(int i=1;i<=pn;i++){
dp[i][1]=p2(arr[i]-arr[1]);
}
for(int i=2;i<=pn;i++){
for(int j=2;j<=qn;j++){
for(int k=i-1;k>=1;k--){
dp[i][j]=min(dp[i][j],dp[k][j-1]+p2(arr[i]-arr[k+1]));
}
}
}
ans=1e10;
for(int i=1;i<=qn;i++)
ans=min(ans,dp[pn][i]);
printf("%.2lf\n",ans);
} /*
140.59 168 170 180 199.99
*/
T2
模拟(竟然没改出来,遗憾死了……)
所以:
$$\Huge \sqcup$$
T3
采用法2。
类似抵制克苏恩?
设$f_{i,j,k,x}$为有$i$种球只剩一个,$j$种球只剩两个,$k$个球只剩三个,上次拿的球有$x$个(拿之前)
于是用记忆搜,转移并不费力。
因为没取模,于是码一个高精度。
不要用 __int128_t ! 不要用 __int128_t ! 不要用 __int128_t !
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define L 55
#define N 16 using namespace std; struct Hyper_long{
int A[L];
Hyper_long(){memset(A,0,sizeof A);A[0]=1;}
int length(){return A[0];}
void set_l(int len){this->A[0]=len;}
int &operator [](int id){
return A[id];
}
friend Hyper_long operator + (Hyper_long &a,Hyper_long &b){
Hyper_long c;
int len=max(a.length(),b.length()),r=0;
for(int i=1;i<=len;i++){
c[i]=a[i]+b[i]+r;//cout<<c[i]<<endl;
r=c[i]/10000;//cout<<r<<endl;
c[i]%=10000;//cout<<c[i]<<endl;
}
if(r){
len++;
c[len]=r;
}
c.set_l(len);
return c;
}
void out(){
printf("%d",A[A[0]]);;
for(int i=A[0]-1;i>0;i--)
printf("%04d",A[i]);
puts("");
}
}dp[N][N][N][N],_1;
bool m[N][N][N][N];
int cn,bn[N],pos[N];
Hyper_long operator * (Hyper_long a,int b){
Hyper_long c;
int len=a.length();
long long r=0;
for(int i=1;i<=len;i++){
c[i]=a[i]*b+r;
r=c[i]/10000;
c[i]%=10000;
}
while(r){
len++;
c[len]=r%10000;
r=c[len]/10000;
}
c.set_l(len);
return c;
}
void operator += (Hyper_long &a,Hyper_long b){a=a+b;}
Hyper_long dfs(int i,int j,int k,int las){
if((!i)&&(!j)&&(!k))return _1;
if(m[i][j][k][las])return dp[i][j][k][las];
Hyper_long ans;
if(i) ans+=dfs(i-1,j ,k ,1)*(i-(las==2));
if(j) ans+=dfs(i+1,j-1,k ,2)*(j-(las==3));
if(k) ans+=dfs(i ,j+1,k-1,3)*(k-(las==4));
m[i][j][k][las]=1;
return dp[i][j][k][las]=ans;
}
int main(){
cin.sync_with_stdio(false);
_1[0]=_1[1]=1;
cin>>cn;
for(int i=1;i<=cn;i++){
cin>>bn[i];
pos[bn[i]]++;
}
dfs(pos[1],pos[2],pos[3],6).out();
}
19-10-26-F的更多相关文章
- 2018.10.26 浪在ACM 集训队第二次测试赛
2018.10.26 浪在ACM 集训队第二次测试赛 整理人:苗学林 A海港 参考博客:[1]:李继朋https://www.cnblogs.com/violet-acmer/p/9859006.ht ...
- 程序员的 Ubuntu 19.10 配置与优化指南
原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...
- 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null
[源码下载] 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null 作者:webabcd 介绍背水一战 Windows 10 之 XAML ...
- forever start Error: Cannot find module './daemon.v0.10.26'
我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3590158.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...
- 2018.10.26 浪在ACM 集训队第四次测试赛
2018.10.26 浪在ACM 集训队第四次测试赛 题目一览表 来源 考察知识点 完成时间 A 生活大爆炸版 石头剪刀布 NOIP 提高组 2014 模拟??? 2018.11.9 B 联合 ...
- 欢迎来怼——第14次Scrum会议(10/26)
一.小组信息 队名:欢迎来怼小组成员队长:田继平成员:李圆圆,葛美义,王伟东,姜珊,邵朔,冉华 小组照片 二.开会信息 时间:2017/10/26 17:00~17:13(总计13min).地点:计 ...
- ubuntun 下安装 node-v0.10.26
sudo apt-get install g++ curl libssl-dev apache2-utils wget http://nodejs.org/dist/v0.10.26/node-v0. ...
- Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24
作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...
- [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录
在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...
- [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版
硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...
随机推荐
- TopCoder[SRM513 DIV 1]:PerfectMemory(500)
Problem Statement You might have played the game called Memoria. In this game, there is a board ...
- ajax跨域获取网站json数据
由于自己的公司的项目需要调用视频地址 1:当为链接时:直接在播放器用数据库查找的地址 2:当为外部链接时:直接用window.location.href('数据库查找的地址') 3:当为H5链接时:使 ...
- VS2010-MFC(常用控件:列表视图控件List Control 上)
转自:http://www.jizhuomi.com/software/195.html 列表视图控件简介 列表视图控件List Control同样比较常见,它能够把任何字符串内容以列表的方 ...
- 转:Linux环境下段错误的产生原因及调试方法小结
源地址:http://www.cnblogs.com/panfeng412/archive/2011/11/06/2237857.html 补充:http://baike.baidu.com/link ...
- HDU-1501-Zipper-字符串的dfs
Given three strings, you are to determine whether the third string can be formed by combining the ch ...
- 生成器yield(17-06)
yield 执行以上代码,yield后面可以有返回值 next() 获取 next的使用次数,是你生成器中yield出现的次数 def p(): print("ok") yiel ...
- 笔记:Python操作sql
python操作mysql步骤: 创建connect连接 conn = connect(host='127.0.0.1', port=3306, user='root', password='1234 ...
- mac nginx php php-fpm
#the php-fpm config and cammand... cp /private/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf ...
- java 上传MultipartFile和String post请求
/** * POST Multipart Request * @Description: * @param requestUrl 请求url * @param requestText 请求参数 * @ ...
- FileCloud 的原理简述&自己搭建文件云
FileCloud 的原理简述&自己搭建文件云 copyright(c) by zcy 关于如何使用IIS创建asp服务,请读者自行研究 注:不要忘记添加入站规则 代码的存储: 根目录 fil ...