【HDOJ】1512 Monkey King】的更多相关文章

左偏树+并查集.左偏树就是可合并二叉堆. /* 1512 */ #include <iostream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deque> #include <algorithm> #include &l…
DP问题,我是按照边排序的,排序既要考虑x也要考虑y,同时在每个面中,长宽也要有序.还有注意状态转移,当前高度并不是之前的最大block叠加的高度,而是可叠加最大高度+当前block高度或者是当前block高度.最后,n^2的复杂度. #include <stdio.h> #include <stdlib.h> #define MAXTYPE 33 #define MAXNUM 3*MAXTYPE typedef struct { int x, y, z; } rect; rect…
常规 事件 约束限制 调试 原文参见:http://www.douban.com/note/257030384/ 常规 –help 列出简单的用法. -v 命令行的每一个 -v 将增加反馈信息的级别. Level 0(缺省值)除启动提示.测试完成和最终结果之外,提供较少信息. Level 1提供较为详细的测试信息,如逐个发送到Activity的事件. Level 2提供更加详细的设置信息,如测试中被选中的或未被选中的Activity. 日志级别 Level 0 示例 adb shell monk…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=1512 [题目大意] 现在有 一群互不认识的猴子,每个猴子有一个能力值,每次选择两个猴子,挑出他们所归属的部落中能力值最强的猴子打架,然后两个最强的猴子能力值减半,之后两个部落就合为一个部落,问每次合并后部落中最强的猴子能力值是多少 [题解] 要求每次取出一堆数字中最大的数字减半再放回去,显然这是优先队列可以完成的操作,但由于之后要将两堆数字合并,所以采用可并优先队列,考虑使用左偏树.在左偏树的维…
[题目分析] 也是堆+并查集. 比起BZOJ 1455 来说,只是合并的方式麻烦了一点. WA了一天才看到是多组数据. 盲人OI (- ̄▽ ̄)- Best OI. 代码自带大常数,比启发式合并都慢 [代码] #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <set> #include <map> #include <…
Monkey King Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4714    Accepted Submission(s): 2032 Problem Description Once in a forest, there lived N aggressive monkeys. At the beginning, they e…
题目链接: http://codeforces.com/problemset/problem/710/A 题目大意: 国际象棋标准8X8棋盘,国王能往周围8个方向走.输入国王的位置,输出当前国王能往几个方向走. 题目思路: [模拟] 签到题(看错题目WA了一次).边界处理下就好. // //by coolxxx //#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<str…
http://acm.hdu.edu.cn/showproblem.php?pid=3047 Zjnu Stadium Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4799    Accepted Submission(s): 1849 Problem Description In 12th Zhejiang College Stud…
AC通道:http://www.lydsy.com/JudgeOnline/problem.php?id=1087 [题解] 用f[i][j][k]表示前i行放了j个棋子且第i行的状态为k的方案数. vis[i]表示状态i是否合法,check[i][j]表示状态i,j是否可以相邻. 详见代码: /************* bzoj 1087 by chty 2016.11.15 *************/ #include<iostream> #include<cstdio>…
Monkey King Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6667    Accepted Submission(s): 2858 Problem Description Once in a forest, there lived N aggressive monkeys. At the beginning, they e…