看来快掉到灰名的蒟蒻涨rating也快。。。

A题模拟一下就好(一开始还sb,,

 #include<bits/stdc++.h>
#define LL long long
using namespace std;
bool vis[];
int ans,tot,a[],n;
int main()
{
scanf("%d",&n);
for (int i=; i<=*n; i++)
{
int x; scanf("%d",&x);
if (!vis[x]) tot++,vis[x]=; else tot--;
ans=max(ans,tot);
}
cout<<ans;
}

B的话,比较神。。读完题一看,这不是个三分嘛。。B题怎么可能出三分。。然而还是水了个三分交上,(各种怕卡精度卡精度,然而还是可以的)

 #include<bits/stdc++.h>
#define LL long long
#define eps 1e-8
using namespace std;
int n,x[],v[];
double get_dis(double pos)
{
double t=;
for (int i=; i<=n; i++)
t=max(t,fabs((double)pos-x[i])/(double)v[i]);
return t;
}
int main()
{
scanf("%d",&n);
for (int i=; i<=n; i++) scanf("%d",&x[i]);
for (int i=; i<=n; i++) scanf("%d",&v[i]);
double l=,r=1e9; int tot=;
double mid1,mid2;
while (r-l>eps)
{
mid1=(r-l)/+l,mid2=(r-l)/*+l;
if (get_dis(mid1)-get_dis(mid2)>eps) l=mid1;
else r=mid2;
if (++tot>) break;
}
printf("%.10lf",get_dis(mid1));
return ;
}

C题的话,,比较难写(其实是我太弱了),比较好想,最多就是儿子最多节点,儿子加上自己。(自己画个图就看出来了),

知道了这个就可以构造了。。

 #include<bits/stdc++.h>
#define LL long long
#define N 100005
#define eps 1e-8
using namespace std;
int pos,n,col[N<<],mx;
struct edge{
int to,next;
}e[N<<];
int head[N<<],cnt;
void insert(int x, int y)
{
e[++cnt].to=y; e[cnt].next=head[x]; head[x]=cnt;
}
void dfs(int x, int fa)
{
int size=;
for (int i=head[x];i;i=e[i].next)
{
if (e[i].to==fa) continue;
size++;
dfs(e[i].to,x);
}
if (x==)
{
if (size+>mx) mx=size+,pos=x;
}
else if (size+>mx) mx=size+,pos=x;
}
void solve_paint(int x, int fa)
{
int orz=;
for (int i=head[x];i;i=e[i].next)
{
while (orz==col[x] || orz==col[fa]) orz++;
if (e[i].to==fa) continue;
col[e[i].to]=orz; orz++;
solve_paint(e[i].to,x);
}
}
int main()
{
scanf("%d",&n);
for (int i=; i<n; i++)
{
int x,y; scanf("%d%d",&x,&y);
insert(x,y);
insert(y,x);
}
dfs(,);
cout<<mx<<endl;
col[pos]=;
solve_paint(pos,);
for (int i=; i<=n; i++)
printf("%d ",col[i]);
return ;
}

D题看不懂题,随便做了一个交上过了pretext满心欢喜,结果还是最后挂掉了。。

cf 782# A.Andryusha and Socks B.The Meeting Place Cannot Be Changed C.Andryusha and Colored Balloons的更多相关文章

  1. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) A. Andryusha and Socks

    地址:http://codeforces.com/contest/782/problem/A 题目: A. Andryusha and Socks time limit per test 2 seco ...

  2. AC日记——Andryusha and Socks Codeforces 780a

    A. Andryusha and Socks time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  3. CF782A Andryusha and Socks

    题意: Andryusha is an orderly boy and likes to keep things in their place. Today he faced a problem to ...

  4. Codeforces 782C. Andryusha and Colored Balloons 搜索

    C. Andryusha and Colored Balloons time limit per test:2 seconds memory limit per test:256 megabytes ...

  5. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) C Andryusha and Colored Balloons

    地址:http://codeforces.com/contest/782/problem/C 题目: C. Andryusha and Colored Balloons time limit per ...

  6. code force 403C.C. Andryusha and Colored Balloons

    C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes ...

  7. codeforces781A Andryusha and Colored Balloons

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  8. AC日记——Andryusha and Colored Balloons codeforces 780c

    C - Andryusha and Colored Balloons 思路: 水题: 代码: #include <cstdio> #include <cstring> #inc ...

  9. C. Andryusha and Colored Balloons

    C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes ...

随机推荐

  1. vue基础语法摘要

    1. 2. 3. 4. 5. 6. 7.“动态路由”和“编程式路由”参数的接收方式:路由的参数-----页面之间跳转的参数

  2. 「IOI2014」Wall 砖墙

    题目描述 给定一个初始元素为 \(0\) 的数列,以及 \(K\) 次操作: 将区间 \([L, R]\) 中的元素对 \(h\) 取 \(max\) 将区间 \([L, R]\) 中的元素对 \(h ...

  3. uniGUI之uniPanel(20)

    1]uniPanel常用设置: 2]多个uniPanel在一个uniPanel里显示 uniPanel常用设置: 2]多个uniPanel在一个uniPanel里显示 uniPanel0.Alignm ...

  4. Python 全国考级二级

    第1章  Python概述 [Python语言简介] Python是一种跨平台.开源.免费的解释型高级动态编程语言,是一种通用编程语言. Python支持命令式编程和函数式编程两种方式,并且完全支持面 ...

  5. 简单讲解什么是黑帽SEO

    此文章主要讲的是黑帽SEO之搜索引擎劫持: SEO(Search Engine Optimization)搜索引擎优化,简单来说,就是让网站的排名更高,比如,搜索"博客"这个关键字 ...

  6. 多年珍藏的55w御剑字典

    御剑珍藏55w目录字典,很给力,放在以前直接数据库都能给跑出来. 用法:直接把放入配置文件的目录 链接:https://pan.baidu.com/s/1MGxdd9hH006Y7AO7CpkO8g ...

  7. ubuntu18.04调整终端字体大小

    一.在终端内右键->Preferences. 二.选中Custom font,然后点击旁边的Monospace Regular 20. 三.在该界面可以选择字体类型,右下角可以调整字体大小.

  8. 如何使用Docker部署PHP开发环境

    本文主要介绍了如何使用Docker构建PHP的开发环境,文中作者也探讨了构建基于Docker的开发环境应该使用单容器还是多容器,各有什么利弊.推荐PHP开发者阅读.希望对大家有所帮助. 环境部署一直是 ...

  9. ubuntu18.04 LAMP DVWA

    一.基本擦作: sudo apt-get install lamp-server^ sudo chmod 777 /var/www #也有可能是/var/www/html,访问127.0.0.1验证是 ...

  10. POJ 2718 Smallest Difference dfs枚举两个数差最小

    Smallest Difference Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19528   Accepted: 5 ...