看来快掉到灰名的蒟蒻涨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. Day11 - K - Good Luck in CET-4 Everybody! HDU - 1847

    大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此.当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考 ...

  2. python3 引入selenium库报错ModuleNotFoundError: No module named 'selenium'

    解决方法: pip install -U selenium

  3. Spring MVC中的ResponseEntity和ResponseBody的区别

    1.ResponseEntity的优先级高于@ResponseBody. 在不是ResponseEntity的情况下才去检查有没有@ResponseBody注解. 如果响应类型是ResponseEnt ...

  4. 怎样把exe程序注册成系统服务

    怎样把exe程序注册成系统服务 最近一段时间我们公司开发一款新的产品,要在服务器上运行一个服务端程序,为了方便我就希望能将这个程序注册成系统服务开机自动启动而不用每次重启系统都要手动启动程序.要实现这 ...

  5. python 通过UDP传输文件

    使用一个简单的python脚本将一个本地文件以码流的形式,通过UDP协议发送到对端: import socket import os import stat import struct   MAX_P ...

  6. 微信小程序中,如何实现显示,隐藏密码的功能

    最近在搞小程序的开发,遇到隐藏,显示密码的功能的时候,电脑上调试没问题,但是手机上面点击却没有效果,必须要跳转到其他页面再跳回来,才能正常显示. 一时间搞得我很头疼,查找资料后,终于知道了是什么原因. ...

  7. 解决Ubuntu(linux)系统中PHP的curl函数无法使用的问题

    我之前用的Windows的服务器,未出现问题,后来把服务器重装了系统,今天在学微信公众号获取信息的时候,发现curl函数出现了问题...... 解决方法 首先连接上服务器,找到/etc/php/7.0 ...

  8. SSH和screen服务

    SSH是一种能够以安全的方式提供远程登录的协议,目前远程管理的首选方式,sshd是基于SSH协议开发的一款远程管理服务程序,在Linux系统中需要部署sshd服务程序才能使用SSH协议来进行远程管理, ...

  9. 在cnblog中试用Markdown

    参考: http://www.cnblogs.com/cmt/p/markdown.html https://www.cnblogs.com/cmt/p/markdown-latex.html htt ...

  10. 如何给Sqlite添加复合主键

    如果是想两个字段组成一个复合主键的话可以如下.SQL code sqlite> create table t2 ( ...> id1 int , ...> id2 int, ...& ...