2017 Multi-University Training Contest - 2
HDU 6045
#pragma comment(linker, "/STACK:102400000,102400000")
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define ll long long
#define mod 1000000007
using namespace std;
int t;
int n,x,y;
char a[],b[];
int main()
{
scanf("%d",&t);
for(int i=;i<=t;i++){
scanf("%d %d %d",&n,&x,&y);
scanf("%s",a);
scanf("%s",b);
int res=;
for(int j=;j<n;j++){
if(a[j]==b[j])
res++;
}
if(x+y<=n+res&&abs(x-y)<=n-res)
printf("Not lying\n");
else
printf("Lying\n");
}
return ;
}
HDU 6047
#pragma comment(linker, "/STACK:102400000,102400000")
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define ll long long
#define mod 1000000007
using namespace std;
int n;
ll a[];
ll b[];
ll dp[];
int main()
{
while(scanf("%d",&n)!=EOF){
for(int i=;i<=n;i++)
scanf("%lld",&a[i]);
for(int i=;i<=n;i++)
scanf("%lld",&b[i]);
sort(b+,b++n);
dp[n+]=;
for(int i=n;i>=;i--)
dp[i]=max(dp[i+],a[i]-i);
ll ans=;
ll now=;
for(int i=n+;i<=*n;i++){
ll zha=max(dp[b[i-n]],now);
ans+=zha;
ans%=mod;
now=max(now,zha-i);
}
printf("%lld\n",ans);
}
return ;
}
HDU 6049
#include <iostream>
#include <cstdio>
using namespace std;
const int N=;
int f[N][N],minN[N][N],maxN[N][N],last[N];
int n,a[N];
void work()
{
int i,j,k,ii,jj;
for (i=; i<=n; i++)
{
f[i][i]=;
last[i]=i;
minN[i][i]=maxN[i][i]=a[i];
for(j=i+; j<=n; j++)
{
minN[i][j]=min(minN[i][j-],a[j]);
maxN[i][j]=max(maxN[i][j-],a[j]);
}
}
for(k=; k<=n; k++)
for(i=; i<=n-k+; i++)
{
j=i+k-;
if (maxN[i][j]-minN[i][j]!=j-i)
f[i][j]=;
else
{
if (minN[i][j]<minN[i][last[i]])f[i][j]=;
else
f[i][j]=f[i][last[i]]+f[last[i]+][j];
last[i]=j;
}
}
int ans=f[][n];
for (i=; i<=n; i++)
for (j=i; j<=n; j++)
if (f[i][j]&&(i==||f[][i-]&&minN[][i-]==))
{
jj=maxN[i][j];
if (jj==n||maxN[jj+][n]==n&&f[jj+][n])
for (ii=jj; ii>j; ii--)
if (f[ii][jj]&&minN[ii][jj]==i)
ans=max(ans,f[][i-]+f[j+][ii-]+f[jj+][n]+);
}
cout<<ans<<endl;
}
int main()
{
int T,i,j;
cin>>T;
for (i=; i<=T; i++)
{
cin>>n;
for (j=; j<=n; j++)cin>>a[j];
work();
}
return ;
}
HDU 6055
#pragma comment(linker, "/STACK:102400000,102400000")
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define ll long long
#define mod 1000000007
using namespace std;
int n;
struct node
{
int x,y;
} N[];
int mp[][];
int main()
{ while(scanf("%d",&n)!=EOF)
{
memset(mp,,sizeof(mp));
for(int i=; i<=n; i++)
{
scanf("%d %d",&N[i].x,&N[i].y);
mp[N[i].x+][N[i].y+]=;
}
int ans=;
for(int i=; i<=n; i++){
for(int j=; j<=n; j++){
if(i==j)
continue;
int x,y,xx,yy;
x=N[i].x;y=N[i].y;
xx=N[j].x;yy=N[j].y;
int x1,y1,x2,y2;
int x3,y3,x4,y4;
if((x>=xx&&y>yy)){
x1=xx+abs(y-yy)+abs(x-xx);
y1=y-abs(x-xx);
x2=xx+abs(y-yy);
y2=yy-abs(x-xx);
x3=x-abs(y-yy);
y3=y+abs(x-xx);
x4=x-abs(y-yy)-abs(x-xx);
y4=yy+abs(x-xx);
if(x1+>=&&y1+>=&&x2+>=&&y2+>=&&mp[x1+][y1+]&&mp[x2+][y2+]){
ans++;
}
if(x3+>=&&y3+>=&&x4+>=&&y4+>=&&mp[x3+][y3+]&&mp[x4+][y4+]){
ans++;
}
}
}
}
printf("%d\n",ans/);
}
return ;
}
2017 Multi-University Training Contest - 2的更多相关文章
- 2017 Wuhan University Programming Contest (Online Round) Lost in WHU 矩阵快速幂 一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开。
/** 题目:Lost in WHU 链接:https://oj.ejq.me/problem/26 题意:一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开. ...
- 2017 Wuhan University Programming Contest (Online Round) C. Divide by Six 分析+模拟
/** 题目:C. Divide by Six 链接:https://oj.ejq.me/problem/24 题意:给定一个数,这个数位数达到1e5,可能存在前导0.问为了使这个数是6的倍数,且没有 ...
- 2017 Wuhan University Programming Contest (Online Round) B Color 树形dp求染色方法数
/** 题目:Color 链接:https://oj.ejq.me/problem/23 题意:给定一颗树,将树上的点最多染成m种颜色,有些节点不可以染成某些颜色.相邻节点颜色不同.求染色方法数. 思 ...
- 2017 Wuhan University Programming Contest (Online Round) D. Events,线段树区间更新+最值查询!
D. Events 线段树区间更新查询区间历史最小值,看似很简单的题意写了两天才写出来. 题意:n个数,Q次操作,每次操作对一个区间[l,r]的数同时加上C,然后输出这段区间的历史最小值. 思路:在线 ...
- 2017 Multi-University Training Contest - Team 9 1005&&HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】
FFF at Valentine Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】
Dying Light Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- 2017 Multi-University Training Contest - Team 9 1003&&HDU 6163 CSGO【计算几何】
CSGO Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- 2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】
Ch’s gift Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- 2017 Multi-University Training Contest - Team 9 1001&&HDU 6161 Big binary tree【树形dp+hash】
Big binary tree Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- 2017 Multi-University Training Contest - Team 1 1003&&HDU 6035 Colorful Tree【树形dp】
Colorful Tree Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
随机推荐
- mysql常用语句入门整理
这篇属于小白入门级别,如果你已经高手可以直接跳过 1.运行数据库mysqld.exe,客户端直接mysql -uroot(root是默认用户名) -p 2 showdatabases,showtabl ...
- Java连接池
- LeetCode 48. Rotate Image (C++)
题目: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwis ...
- Beta发布-----欢迎来怼团队
欢迎来怼项目小组—Beta发布展示 一.小组成员 队长:田继平 成员:葛美义,王伟东,姜珊,邵朔,阚博文 ,李圆圆 二.文案+美工展示 链接:http://www.cnblogs.com/js2017 ...
- 2018软工实践—Alpha冲刺(5)
队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭鸭鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 协助测试的进行 测试项目运行的服务器环境 ...
- 0330复利计算java版
package compounding; import java.util.Scanner; public class compounding1_1 { public static void main ...
- scrum 项目准备1.0
---3.0--------------------------------------------------------------------- 5.Scrum团队成立 5.1 团队名称,团队目 ...
- Jarvis OJ平台basic部分wirteup
Base64? 题目描述: GUYDIMZVGQ2DMN3CGRQTONJXGM3TINLGG42DGMZXGM3TINLGGY4DGNBXGYZTGNLGGY3DGNBWMU3WI=== Base3 ...
- 关于java读取excle文件的相关方法 ;
1.读取Excle文件内容的方法 拿过来可以直接用 : 2.参照 http://www.anyrt.com/blog/list/importexcel.html#6 更多知识请参考:http://ww ...
- apache server-status配置
引言 自己配置LAMP服务器时(xwamp),获取状态信息出现错误: You don't have permission to access /server-status on this server ...