当前位置: 首页 > news >正文

个人网站-个人主页作业免费成品网站模板下载

个人网站-个人主页作业,免费成品网站模板下载,有个人代做网站的吗,游戏开发大亨破解版CF1561C Deep Down Below 题解题目链接字面描述Deep Down Below题面翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1提示思路TLE算法具体思想TLE特例AC思想代码实现备注题目 链接 https://www.luogu.com.cn/problem/CF1561C 字面描述 Deep Down Below 题面翻译… CF1561C Deep Down Below 题解题目链接字面描述Deep Down Below题面翻译题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1提示思路TLE算法具体思想TLE特例AC思想代码实现备注题目 链接 https://www.luogu.com.cn/problem/CF1561C 字面描述 Deep Down Below 题面翻译 TTT 组数据每次给定 nnn 个任务第 iii 个任务给定 kik_iki​ 个怪物每个怪物有一个能力值 ai,ja_{i,j}ai,j​ 你要按顺序把这 kik_iki​ 个怪物杀死你能杀死一个怪物当且仅当你的能力值严格大于怪物的能力值杀死一个怪物后你的能力值将会 111。 你可以按任意顺序完成这 nnn 个任务你需要确定最小的初始能力值。 T≤105,n≤105,ki≤105,∑ki≤105,ai,j≤109T\leq 10^5,n\leq 10^5,k_i\leq10^5,\sum k_i\leq 10^5,a_{i,j}\leq 10^9T≤105,n≤105,ki​≤105,∑ki​≤105,ai,j​≤109。 题目描述 In a certain video game, the player controls a hero characterized by a single integer value: power. The hero will have to beat monsters that are also characterized by a single integer value: armor. On the current level, the hero is facing $ n $ caves. To pass the level, the hero must enter all the caves in some order, each cave exactly once, and exit every cave safe and sound. When the hero enters cave $ i $ , he will have to fight $ k_i $ monsters in a row: first a monster with armor $ a_{i, 1} $ , then a monster with armor $ a_{i, 2} $ and so on, finally, a monster with armor $ a_{i, k_i} $ . The hero can beat a monster if and only if the hero’s power is strictly greater than the monster’s armor. If the hero can’t beat the monster he’s fighting, the game ends and the player loses. Note that once the hero enters a cave, he can’t exit it before he fights all the monsters in it, strictly in the given order. Each time the hero beats a monster, the hero’s power increases by $ 1 $ . Find the smallest possible power the hero must start the level with to be able to enter all the caves in some order and beat all the monsters. 输入格式 Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^5 $ ). Description of the test cases follows. The first line of each test case contains a single integer $ n $ ( $ 1 \le n \le 10^5 $ ) — the number of caves. The $ i $ -th of the next $ n $ lines contains an integer $ k_i $ ( $ 1 \le k_i \le 10^5 $ ) — the number of monsters in the $ i $ -th cave, followed by $ k_i $ integers $ a_{i, 1}, a_{i, 2}, \ldots, a_{i, k_i} $ ( $ 1 \le a_{i, j} \le 10^9 $ ) — armor levels of the monsters in cave $ i $ in order the hero has to fight them. It is guaranteed that the sum of $ k_i $ over all test cases does not exceed $ 10^5 $ . 输出格式 For each test case print a single integer — the smallest possible power the hero must start the level with to be able to enter all the caves in some order and beat all the monsters. 样例 #1 样例输入 #1 2 1 1 42 2 3 10 15 8 2 12 11样例输出 #1 43 13提示 In the first test case, the hero has to beat a single monster with armor $ 42 $ , it’s enough to have power $ 43 $ to achieve that. In the second test case, the hero can pass the level with initial power $ 13 $ as follows: enter cave $ 2 $ : beat a monster with armor $ 12 $ , power increases to $ 14 $ ;beat a monster with armor $ 11 $ , power increases to $ 15 $ ; enter cave $ 1 $ : beat a monster with armor $ 10 $ , power increases to $ 16 $ ;beat a monster with armor $ 15 $ , power increases to $ 17 $ ;beat a monster with armor $ 8 $ , power increases to $ 18 $ . 思路 TLE算法 具体思想 本人最初的想法十分的朴素针对nnn个任务维护nnn个队首指针。 每次比较出nnn个任务队首怪兽的最小值与当前预算的能力值比较是否能继续打怪是 - 继续 否 - 加到怪兽能力值1即可。 TLE特例 如果有1e5个任务每个任务只有1个怪兽。 按此算法 时间复杂度退化O(n⋅Σk)≈1e10O(n·Σk)≈1e10O(n⋅Σk)≈1e10 TLE ! ! ! AC思想 2阶段处理 算出每组打怪加能力的情况下每一个怪兽所对应初始能力值并取max将nnn个max从小到大排序依次循环看每个max加上对应任务里的元素数能加多少次能力是否能满足下一个max,是 - continue 否 - 加到下一个max。 时间复杂度O(Σk⋅log(Σk))≈2e6O(Σk·log(Σk))≈2e6O(Σk⋅log(Σk))≈2e6 阶段线性处理tql ! 代码实现 #includebits/stdc.h using namespace std;const int maxn1e510; int t,n,ans; int k[maxn]; vectorinte[maxn]; struct node{int v,cnt; }a[maxn]; inline bool cmp(node p,node q){return p.vq.v;} int main(){scanf(%d,t);while(t--){scanf(%d,n);for(int i1;in;i){e[i].clear();scanf(%d,k[i]);//算每组的最大值for(int j1;jk[i];j){int x;scanf(%d,x);xx2-j;if(j!1)xmax(x,e[i][j-2]);e[i].push_back(x);}a[i].ve[i][k[i]-1];//最大值的最小取值a[i].cntk[i];//任务里的怪兽数//printf(%d %d %d\n,i,a[i].v,a[i].cnt);}sort(a1,an1,cmp);ansa[1].v;int lansa[1].cnt;//排序比较for(int i2;in;i){if(la[i].v){ansansa[i].v-l;la[i].v;}la[i].cnt;}printf(%d\n,ans);}return 0; } 备注 写入好题本
http://www.w-s-a.com/news/428313/

相关文章:

  • 凡科网站怎么做建站关键字搜索网站怎么做
  • 小说网站建站程序企业邮箱地址
  • 福州市住房和城乡建设网站网站开发方案论文
  • 在线教育网站开发网站推广常用方法包括
  • 东莞高端品牌网站建设软件开发模型及特点
  • 个人网站的设计与实现的主要内容网站开发公司架构
  • 浏览器收录网站什么是新媒体营销
  • 上海营销网站建设公司下面哪个不是网页制作工具
  • 有哪些网站可以做设计比赛苏州设计公司排名前十
  • 公益网站建设需求车陂手机网站开发
  • 高端网站建设专业营销团队宁德网站建设51yunsou
  • 网站如何做cdn购物网站建设app开发
  • 简单的手机网站模板好看大方的企业网站源码.net
  • 沈阳住房和城乡建设厅网站网站个人备案做论坛
  • 企业建网站的目的开家网站建设培训班
  • 做怎么网站网站优化和推广
  • 建站工具 风铃网站每年空间域名费用及维护费
  • 网站开发工具 知乎工业软件开发技术就业前景
  • 永济微网站建设费用新手如何自学编程
  • 在本地怎么做网站深圳保障房申请条件2022
  • 广州天河区网站建设公司东莞网络游戏制作开发
  • 哪个网站做免费小程序rio门户网站的制作
  • 短网站生成查询网站所有关键词排名
  • 阿里云购买网站登录技术服务外包公司
  • 淘宝单页面网站手机制作游戏的软件
  • 汉中市网站建设wordpress编辑器好麻烦
  • 织梦做的网站快照被攻击在线看crm系统
  • 青岛物流公司网站建设网站建设提议
  • 企业网站建设高端品牌宿州注册公司多少钱
  • 个人微信公众号怎么做微网站吗湛江网站制作方案