
ACM_常用技巧
文章平均质量分 83
77458
手敲仙盘键,目视星空棋,灵控比特力,逍遥虚空界。
展开
-
在线OJ读取文件防止出错的代码
#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin);#endif // ONLINE_JUDGE原创 2015-06-04 09:05:36 · 612 阅读 · 0 评论 -
POJ - 1222 EXTENDED LIGHTS OUT(反转问题)
EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9081 Accepted: 5904DescriptionIn an extended version of the game Lights Out, is a puz原创 2016-08-14 03:19:54 · 798 阅读 · 0 评论 -
POJ - 3185 The Water Bowls (反转)
The Water BowlsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5852 Accepted: 2296DescriptionThe cows have a line of 20 water bowls from which they drin原创 2016-08-13 16:54:45 · 519 阅读 · 0 评论 -
POJ - 2100 Graveyard Design(尺取法)
Graveyard DesignTime Limit: 10000MS Memory Limit: 64000KTotal Submissions: 6315 Accepted: 1498Case Time Limit: 2000MSDescriptionKing George has recently dec原创 2016-08-13 10:56:37 · 589 阅读 · 0 评论 -
POJ - 2739 Sum of Consecutive Prime Numbers(尺取法)
Sum of Consecutive Prime NumbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 23335 Accepted: 12757DescriptionSome positive integers can be represente原创 2016-08-13 09:22:02 · 541 阅读 · 0 评论 -
POJ - 2566 Bound Found(尺取法)
Bound FoundTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 2897 Accepted: 888 Special JudgeDescriptionSignals of most probably extra-terrestrial ori原创 2016-08-12 23:53:19 · 489 阅读 · 0 评论 -
Aizu - 0531 Paint Color (坐标离散化)
涂色:(日文题目,自己翻译成了中文)为了宣传信息竞赛,要在长方形的三合板上喷油漆来制作招牌。三合板上不需要涂色的部分预先贴好了护板。被护板隔开的区域要涂上不同的颜色,比如上图就应该涂上5种颜色。请编写一个程序计算涂色数量,输入数据中,保证看板不会被护板全部遮住,并且护板的边一定是水平或垂直的。输入:第一个数是宽w(1 ≤ w ≤ 1000000),第二个数是高h(1原创 2016-08-17 11:19:49 · 886 阅读 · 0 评论 -
POJ - 2549 Sumsets(折半枚举)
SumsetsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10573 Accepted: 2882DescriptionGiven S, a set of integers, find the largest d such that a + b + c原创 2016-08-16 19:39:20 · 706 阅读 · 0 评论 -
POJ - 3977 Subset(折半枚举)
SubsetTime Limit: 30000MS Memory Limit: 65536KTotal Submissions: 3193 Accepted: 570DescriptionGiven a list of N integers with absolute values no larger than 1015,原创 2016-08-16 17:07:30 · 637 阅读 · 0 评论 -
POJ - 2674 Linear world(弹性碰撞)
Linear worldTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 3384 Accepted: 753DescriptionThe Disc, being flat, has no real horizon. Any adventurous sail原创 2016-08-16 13:50:22 · 806 阅读 · 0 评论 -
ACM_二进制代替DFS的运用
当所需是一位数组,或者是数组的大小明显小于32位的话,用二进制循环的技巧可以代替DFS繁琐的步骤for(int i = 0; i int total = 0, Min = INF, cnt = 0; for(int j = 0; j if(i >> j & 1) {原创 2015-07-21 20:02:38 · 613 阅读 · 0 评论 -
Bahosain and Digits
/*Author: 2486Memory: 4 KB Time: 78 MSLanguage: GNU G++ 4.9.2 Result: AcceptedPublic: No Yes*///ACM反转类提醒的基本模板#include #include #include #include #include using namespace std;const int原创 2015-07-20 19:50:28 · 740 阅读 · 0 评论 -
Sereja and Array-数组操作或者线段树或树状数组
CodeForces - 315BSereja and ArrayTime Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64uSubmit StatusDescriptionSereja has got an array, cons原创 2015-07-30 09:12:57 · 787 阅读 · 0 评论 -
Moving Tables-贪心
Moving TablesTime Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64uSubmit StatusDescriptionThe famous ACM (Advanced Computer Maker) Company has r原创 2015-07-28 09:18:52 · 1229 阅读 · 0 评论 -
HDU 4585- Shaolin
J - ShaolinTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 4585DescriptionShaolin temple is very famous for its Kongfu monk原创 2015-06-04 08:57:34 · 817 阅读 · 0 评论 -
CCF压缩编码和玲珑杯1066 - Buy Candy(平行四边形优化)
玲珑杯1066 - Buy Candy(传送门) 题解就是个简单的石子合并,一般的石子合并问题我们用O(n3)O(n^3)的复杂度解决,通过平行四边形优化可以达到降低一维,实现O(n2)O(n^2)的复杂度,平行四边形优化可以解决满足如下条件的问题: dp[i][j] = min{dp[i][k]+dp[k+1][j]+w[i][j]} 我们用S[i][j]保存当前让dp[i][j]最优的原创 2016-12-22 14:17:25 · 1355 阅读 · 0 评论