看来快掉到灰名的蒟蒻涨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. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 解决方法

    在VS2012中生成时出错:error C4430: missing type specifier - int assumed. Note: C++ does not support default- ...

  2. netsh命令获取wifi历史连接密码

    首先[win+r]快捷键打开运行,输入cmd.或点击左下角win-运行-cmd 1.netsh wlan show profiles //列出所有的ap名称 2.netsh wlan show pro ...

  3. Spring和SpringMVC的直接

    1.Spring的常用注解 2.SpringMVC的常用注解

  4. Python学习第六课——基本数据类型一之tuple and dict

    元组 (tuple) tu=(11,22,(123,456),[22,55],) # 一般定义元组的时候最后面加一个, # 元组不能被修改或者删除 v = tu[0] # 也可以根据索引取值 prin ...

  5. 学会使用Google hacking

    https://klionsec.github.io/2014/12/14/search-hacking/ 熟练利用Google hacking 来辅助我们快速渗透 http://www.sec-re ...

  6. java学习-初级入门-面向对象①-面向对象概述-结构化程序设计

    为了学习面向对象程序设计,今天我们先利用面向对象以前的知识,设计一个学生类. 要求进行结构化程序设计. 学生类: Student 要求:存储学生的基本信息(姓名.性别.学历层次和年级),实现学生信息的 ...

  7. SystemVerilog Assertion 设计、调试、测试总结(1)

    暑期实习两个月的其中一个任务是:如何在设计中加入断言?以及断言的基本语法.三种应用场景下的断言(如FIFO.FSM.AXI4-lite总线).参考书籍:<System Verilog Asser ...

  8. 【MAVEN】maven项目下载更新pom jar包速度慢 解决方案

    1·下载安装 最新版本的maven https://maven.apache.org/download.cgi 2·速度慢的主要原因是因为默认setting.xml里配置的国外的 maven 数据源 ...

  9. 联想电脑硬盘保护系统EDU8.0.1iso安装

    管理306机房4年了,15年我带领的第一批学生参加吉林省职业院校技能大赛的时候,领导把这个机房交给我负责.那个时候这个机房的机器是全校的顶配,30台DELL16G内存,2T硬盘,I7处理器,后面是6组 ...

  10. Day9 - I - 不要62 HDU - 2089

    杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer).杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍, ...