2012 MUTC 10 总结(The Final MUTC of this Summer)
2012-08-23 23:44
393 查看
题解链接:http://page.renren.com/601081183/note/867254911
题目编号:hdu 4390~4399
这是杭电多校联合的最后一场比赛了,直到最后的这场比赛我们队在比赛中的题目数还是没有突破3题的局限。
今天比赛开始的时候,依然是我的队友读题,而我就随便看了一题在一边想。第一题看到的就是1001,一道排列组合的题目。这几天都有看排列组合的题,不过基本上都不能1y,所以这题我想了一下,翻了一下《组合数学》,然后就放弃了。1001的思路是有的,不过就是不会后期的计算。组合数学是我的弱项,之后的学习必须要加强!
然后就是队友看的1004,刚开始,我想着暴力寻找,用线段树更新,不过到后来才发现用线段树更新结点还是要变成逐个更新。于是,我就没辙了,丢给队友想。
这时,发现1007也有很多人过,所以我就改向去看1007了。听队友讲了一下题意,我基本明白了题目的意思。当时我想了一下最短路来算这个,不过好像不能得到准确的答案,而且操作起来又或者最后的还是有点麻烦的。于是,当时我就想到层次遍历,利用上一层的结果得到当前步数到达各点的最短时间,如果到满足要求的那一层,汇点的状态是无穷大,那么就是不可达。不过我想深一层的时候,发现有可能走多很多条路才得到最优解。于是,我又卡住了。不过很快的,我就想到一个特点,至少要走的那k层走够了以后,其余的部分不就是可以随便走,不过最后要走到汇点吗?然后我就倒过来想,求了以汇点作为源点到其他各点的最短路,然后将两个操作合并起来,最后不就可以得到满足题意的最优解了吗? 最终的代码很快就完成了,不过打错了一点东西,搞到我又debug了好久。不过庆幸的是,在我思路清晰的情况下,打出来的代码提交就是一个1y~赛后看了一下题解,貌似题解的方法会比我的慢上好多。
1007(hdu 4396):
View Code
这次数学知识占的比例比较高,以后的目标还是要在搞好基础算法的同时,训练好数学思维!
——written by Lyon
题目编号:hdu 4390~4399
这是杭电多校联合的最后一场比赛了,直到最后的这场比赛我们队在比赛中的题目数还是没有突破3题的局限。
今天比赛开始的时候,依然是我的队友读题,而我就随便看了一题在一边想。第一题看到的就是1001,一道排列组合的题目。这几天都有看排列组合的题,不过基本上都不能1y,所以这题我想了一下,翻了一下《组合数学》,然后就放弃了。1001的思路是有的,不过就是不会后期的计算。组合数学是我的弱项,之后的学习必须要加强!
然后就是队友看的1004,刚开始,我想着暴力寻找,用线段树更新,不过到后来才发现用线段树更新结点还是要变成逐个更新。于是,我就没辙了,丢给队友想。
这时,发现1007也有很多人过,所以我就改向去看1007了。听队友讲了一下题意,我基本明白了题目的意思。当时我想了一下最短路来算这个,不过好像不能得到准确的答案,而且操作起来又或者最后的还是有点麻烦的。于是,当时我就想到层次遍历,利用上一层的结果得到当前步数到达各点的最短时间,如果到满足要求的那一层,汇点的状态是无穷大,那么就是不可达。不过我想深一层的时候,发现有可能走多很多条路才得到最优解。于是,我又卡住了。不过很快的,我就想到一个特点,至少要走的那k层走够了以后,其余的部分不就是可以随便走,不过最后要走到汇点吗?然后我就倒过来想,求了以汇点作为源点到其他各点的最短路,然后将两个操作合并起来,最后不就可以得到满足题意的最优解了吗? 最终的代码很快就完成了,不过打错了一点东西,搞到我又debug了好久。不过庆幸的是,在我思路清晰的情况下,打出来的代码提交就是一个1y~赛后看了一下题解,貌似题解的方法会比我的慢上好多。
1007(hdu 4396):
View Code
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <cstdlib> using namespace std; const int maxn = 50005; const int inf = 0x7f7f7f7f; struct point{ int cur; int s; int num; bool operator < (const point &x) const { if (cur != x.cur) return cur > x.cur; return num < x.num; } }p[maxn]; void deal(int cc){ int n, t; int maxcur, mk; bool fs = true; scanf("%d", &n); for (int i = 1; i <= n; i++){ scanf("%d%d", &p[i].cur, &p[i].s); p[i].num = i; } printf("Case #%d:\n", cc); if (n <= 550) t = n; else t = 550; for (int i = 1; i <= t; i++){ maxcur = -inf; for (int j = 1; j <= n; j++){ if (maxcur < p[j].cur){ maxcur = p[j].cur; mk = j; } p[j].cur += p[j].s; } p[mk].cur = -inf; if (fs){ printf("%d", mk); fs = false; } else printf(" %d", mk); } if (n > 550){ sort(p + 1, p + n + 1); for (int i = 1, endi = n - 550; i <= endi; i++){ printf(" %d", p[i].num); } } puts(""); } int main(){ int T; scanf("%d", &T); for (int i = 1; i <= T; i++){ deal(i); } return 0; }
这次数学知识占的比例比较高,以后的目标还是要在搞好基础算法的同时,训练好数学思维!
——written by Lyon
相关文章推荐
- The last work of this year - 2012
- Spring AOP 循环应用(This means that said other beans do not use the final version of the bean..)
- The final testing of this term.
- The final summery of the 2016 summer camp
- Open Source Development (This Article Is the Winner of PRSA 2003 Award in Excellence in Technology …
- failed to sync branch You might need to open a shell and debug the state of this repo.
- failed to sync branch You might need to open a shell and debug the state of this repo
- The resource identified by this request is only capable of generating responses with characteristics
- 关于The serializable class XXX does not declare a static final serialVersionUID field of type long的警告
- Eclipse错误:Version 1.5.0_01 of the JVM is not suitable for this product
- Version 当前jdk版本号 of the JVM is not suitable for the this product.Version:1.8 or greater is required
- This version of the rendering library is more recent than your version of ADT plug-in. Please update
- Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
- failed to sync branch You might need to open a shell and debug the state of this repo.
- ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this oper
- Intel Code Challenge Final Round Xor-matic Number of the Graph -- 线性基
- Incorrect decrement of the reference count of an object that is not owned at this point by the caller1
- VMware Linux安装RAC出现Failure at final check of Oracle CRS stack 10的解决
- EWB使用时出错-unable to write EWB program directory please change the permissions of this directory
- 解决方案: the selected file is a solution file but was created by a newer version of this application and cannot be opened