Solved:3

rank:71

E. Everything Has Changed

#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0); int main()
{
int T;
scanf("%d", &T);
while(T--)
{
int m; double R;
scanf("%d%lf", &m, &R); double ans = 2.0 * PI * R;
for(int i = ; i <= m; i++)
{
double x, y, r;
scanf("%lf%lf%lf", &x, &y, &r); double dis = sqrt(x * x + y * y);
if(dis + r < R || dis - r >= R) continue; double c1 = acos((r * r + dis * dis - R * R) / (2.0 * dis * r));
ans += c1 * 2.0 * r;
double c2 = acos((R * R + dis * dis - r * r) / (2.0 * dis * R));
ans -= c2 * 2.0 * R;
}
printf("%.20lf\n", ans);
}
return ;
}

G. Glad You Came

#include <bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll; ui x, y, z;
ui sui()
{
x ^= x << ;
x ^= x >> ;
x ^= x << ;
x ^= x >> ;
ui p = x ^ (y ^ z);
x = y;
y = z;
z = p;
return z;
} ll zx[];
int lz[]; void pushup(int rt)
{
zx[rt] = min(zx[rt << ], zx[rt << | ]);
} void pushdown(int rt)
{
if(lz[rt])
{
lz[rt << ] = max(lz[rt << ], lz[rt]);
lz[rt << | ] = max(lz[rt << | ], lz[rt]);
zx[rt << ] = max(zx[rt << ], (ll)lz[rt << ]);
zx[rt << | ] = max(zx[rt << | ], (ll)lz[rt << | ]);
lz[rt] = ;
}
} void build(int l, int r, int rt)
{
if(l == r)
{
zx[rt] = lz[rt] = ;
return;
}
zx[rt] = lz[rt] = ; int m = l + r >> ;
build(l, m, rt << );
build(m + , r, rt << | );
} void update(int ql, int qr, int v, int l, int r, int rt)
{
if(zx[rt] >= v) return;
if(ql <= l && qr >= r)
{
lz[rt] = max(lz[rt], v);
zx[rt] = max(zx[rt], (ll)v);
return;
} pushdown(rt);
int m = l + r >> ;
if(ql <= m) update(ql, qr, v, l, m, rt << );
if(qr > m) update(ql, qr, v, m + , r, rt << | );
pushup(rt);
} ll query(int l, int r, int rt)
{
if(l == r) return 1LL * (ll)l * zx[rt];
pushdown(rt); ll res = ;
int m = l + r >> ;
res ^= query(l, m, rt << );
res ^= query(m + , r, rt << | );
return res;
} int main()
{
int T;
scanf("%d", &T);
while(T--)
{
int n, m;
cin>>n>>m>>x>>y>>z;
int l, r, v; build(, n, );
for(int i = ; i <= m; i++)
{
ui f1 = sui(), f2 = sui(), f3 = sui();
l = min(f1 % n + , f2 % n + );
r = max(f1 % n + , f2 % n + );
v = f3 % ( << );
update(l, r, v, , n, );
}
printf("%lld\n", query(, n, ));
}
return ;
}

H. Hills And Valleys

构造一个0-9的数组 每次枚举翻转哪两个数就一共45次

然后把两个数组跑一个lcs 枚举翻转的那个数组可以多次匹配

#include <bits/stdc++.h>
using namespace std; char s[];
int a[];
int b[];
int dp[][];
int l[][];
int r[][];
int n, cnt, nl, nr;
int ans, ansl, ansr; void solve(int len)
{
for(int i = ; i <= len; i++) dp[][i] = ;
for(int i = ; i <= n; i++)
{
for(int j = ; j <= len; j++)
{
dp[i][j] = dp[i - ][j];
l[i][j] = l[i - ][j];
r[i][j] = r[i - ][j];
if(a[i] == b[j])
{
dp[i][j]++;
if(j == nl && l[i][j] == ) l[i][j] = i;
if(j == nr) r[i][j] = i;
} if(dp[i][j - ] > dp[i][j])
{
dp[i][j] = dp[i][j - ];
l[i][j] = l[i][j - ];
r[i][j] = r[i][j - ];
}
}
}
} int main()
{
int T;
scanf("%d", &T);
while(T--)
{
scanf("%d", &n);
scanf("%s", s);
int zx = , zd = ;
for(int i = ; i <= ; i++) b[i] = i - ;
for(int i = ; i < n; i++)
{
a[i + ] = s[i] - '';
zx = min(zx, a[i + ]);
zd = max(zd, a[i + ]);
} solve();
ansl = ;
ansr = ;
ans = dp[n][];
for(int i = zx; i <= zd; i++)
{
for(int j = zx; j < i; j++)
{
cnt = ;
for(int a = ; a <= j; a++) b[++cnt] = a;
nl = cnt + ;
for(int a = i; a >= j; a--) b[++cnt] = a;
nr = cnt;
for(int a = i; a < ; a++) b[++cnt] = a;
solve(cnt); if(dp[n][cnt] > ans && l[n][cnt] && r[n][cnt])
{
ans = dp[n][cnt];
ansl = l[n][cnt];
ansr = r[n][cnt];
}
}
}
printf("%d %d %d\n", ans, ansl, ansr);
}
return ;
}

HDU多校Round 5的更多相关文章

  1. HDU多校Round 8

    Solved:2 rank:141 D. Parentheses Matrix n,m有一个小于6的时候是一种构造方法 答案是n + (m - 2) / 2 (n > m) 都大于6的时候 可以 ...

  2. HDU多校Round 7

    Solved:2 rank:293 J. Sequense 不知道自己写的什么东西 以后整数分块直接用 n / (n / i)表示一个块内相同n / i的最大i #include <bits/s ...

  3. HDU多校Round 6

    Solved:2 rank:452 I. Werewolf 没有铁人 找铁狼 如果一个环中只有一条狼人边那个人就是铁狼 说铁狼是好人的人也是铁狼 #include <bits/stdc++.h& ...

  4. HDU多校Round 4

    Solved:3 rank:405................................. B. Harvest of Apples 知道了S(n,m) 可以o(1)的求S(n - 1, m ...

  5. HDU多校Round 3

    Solved:4 rank:268 C. Dynamic Graph Matching  状压DP一下 #include <stdio.h> #include <algorithm& ...

  6. HDU多校Round 1

    Solved:5 rank:172 A.Maximum Multiple #include <stdio.h> #include <algorithm> #include &l ...

  7. hdu 5667 BestCoder Round #80 矩阵快速幂

    Sequence  Accepts: 59  Submissions: 650  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536 ...

  8. hdu 5643 BestCoder Round #75

    King's Game  Accepts: 249  Submissions: 671  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 6 ...

  9. hdu 5641 BestCoder Round #75

    King's Phone  Accepts: 310  Submissions: 2980  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: ...

随机推荐

  1. 通过shell脚本批处理es数据

    #!/bin/sh [按照指定的域名-website集合,遍历各个域名,处理url] #指定待删除的变量集合 arr=(6.0) cur="`date +%Y%m%d%H%M%S`" ...

  2. document.getElementsByClassName("head")[0].parentElement

    document.getElementsByClassName("head")[0].parentElement

  3. aarch64-linux-gnu交叉编译Qt4.7.3

    到 Qt 官网下载合适的 Qt 版本,地址:http://download.qt-project.org/archive/qt/ 1.环境搭建: 1.安装automake.libtool 和主机上的 ...

  4. vi/vim命令

    vi / vim是Unix / Linux上最常用的文本编辑器而且功能非常强大.

  5. PL/SQL -->隐式游标(SQL%FOUND)

    PL/SQL -->隐式游标(SQL%FOUND) 分类: SQL/PLSQL 基础2010-12-22 16:23 4084人阅读 评论(0) 收藏 举报 sqlexceptionoracle ...

  6. linux CentOS中创建用户 无密码登录

    首先点击左上角的 “应用程序” -> “系统工具” -> “终端”,首先在终端中输入 su ,按回车,输入 root 密码以 root 用户登录,接着执行命令创建新用户 hadoop: 接 ...

  7. python3 批量管理Linux服务器 下发命令与传输文件

    #!/usr/bin/env python3 # -*- coding: utf-8 -*- import paramiko import os, stat import sys import ope ...

  8. [POI2013]POL-Polarization

    题目描述 Everyone knew it would only be a matter of time. So what? Faced for years on, a peril becomes t ...

  9. 题解报告:hdu 1312 Red and Black(简单dfs)

    Problem Description There is a rectangular room, covered with square tiles. Each tile is colored eit ...

  10. Android 性能优化(13)网络优化( 9)Determining and Monitoring the Docking State and Type

    Determining and Monitoring the Docking State and Type PreviousNext This lesson teaches you to Determ ...