博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1094. The Largest Generation (25)
阅读量:4071 次
发布时间:2019-05-25

本文共 655 字,大约阅读时间需要 2 分钟。

题目传送门:

AC代码

#include 
#include
#include
#include
#include
#include
#include
#include
using namespace std;struct Node{ int id,level; Node * parent; Node(int x):id(x),parent(NULL){};};int main(){ int n,m; scanf("%d %d",&n,&m); vector
ans; for (int i=0; i
parent = ans[curid-1]; } } map
res; for(int i=0;i
parent) { curCount++; p = p->parent; } ans[i]->level = curCount; res[curCount]++; } int targetID = 0,targetNum = 0; for (auto it = res.begin();it!=res.end();++it) { if(it->second>targetNum) { targetNum = it->second; targetID = it->first; } } printf("%d %d\n",targetNum,targetID); return 0;}

转载地址:http://yqhji.baihongyu.com/

你可能感兴趣的文章
如何高效利用GitHub
查看>>
环境分支-git版本管理
查看>>
uni-app 全局变量
查看>>
js判断空对象的几种方法
查看>>
java 不用递归写tree
查看>>
springboot2 集成Hibernate JPA 用 声明式事物
查看>>
fhs-framework jetcache 缓存维护之自动清除缓存
查看>>
SpringBoot 动态编译 JAVA class 解决 jar in jar 的依赖问题
查看>>
fhs-framework springboot mybatis 解决表关联查询问题的关键方案-翻译服务
查看>>
ZUUL2 使用场景
查看>>
Spring AOP + Redis + 注解实现redis 分布式锁
查看>>
elastic-job 和springboot 集成干货
查看>>
php开发微服务注册到eureka中(使用sidecar)
查看>>
mybatis mybatis plus mybatis jpa hibernate spring data jpa比较
查看>>
支付宝生活号服务号 用户信息获取 oauth2 登录对接 springboot java
查看>>
CodeForces #196(Div. 2) 337D Book of Evil (树形dp)
查看>>
uva 12260 - Free Goodies (dp,贪心 | 好题)
查看>>
uva-1427 Parade (单调队列优化dp)
查看>>
【设计模式】学习笔记13:组合模式(Composite)
查看>>
hdu 1011 Starship Troopers (树形背包dp)
查看>>