随笔分类 -  技巧性题目

1 2 下一页

D. Vitya and Strange Lesson
摘要:http://codeforces.com/contest/842/problem/D 1、整体的数组是不用变的,比如数组a[]经过一次询问x后,然后再询问y,相当于询问x ^ y ^ a[i]后的mex值 2、假设所求的答案是k,询问的数字是x,那么对于每个元素a[i],有a[i] ^ x != 阅读全文

posted @ 2017-09-02 19:55 stupid_one 阅读(283) 评论(0) 推荐(0) 编辑

Sort HDU - 5884 哈夫曼权值O(n)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5884 原来求一次哈夫曼可以有O(n)的做法。 具体是,用两个队列,一个保存原数组,一个保存k个节点合并的数值,然后每次选k个的时候,用two point在两个队列中选k个出来即可。 然后又把新的节点放去第二个队列 阅读全文

posted @ 2017-08-23 18:36 stupid_one 阅读(360) 评论(0) 推荐(0) 编辑

B - Average Gym - 101161B 组合数学
摘要:http://codeforces.com/gym/101161/attachments 今天被卡常了,其实是自己对组合数技巧研究的不够。 如果是n, m <= 1e5的,然后取模是质数,那么可以用费马小定理。 如果n, m都比较小,那么其实是直接杨辉三角。不用逆元那些。 这题的思路是,枚举每一一个 阅读全文

posted @ 2017-08-08 21:31 stupid_one 阅读(288) 评论(0) 推荐(0) 编辑

Seven-segment Display 贪心选择,快速判断能否有解
摘要:https://csacademy.com/contest/round-39/task/seven-segment-display/ 可以知道,只有1是无解 而且肯定是选出来的位数约小越好。 位数 = (k + 6) / 7,因为总是可以通过买7来最大化缩小位数 然后枚举每一位选什么,选的时候,需要 阅读全文

posted @ 2017-07-27 02:06 stupid_one 阅读(389) 评论(0) 推荐(0) 编辑

两句话题意 感觉这一题的套路很强
摘要:http://acm.uestc.edu.cn/#/problem/show/1171 颠覆了我求gcd的思路,以前的都是mobius求gcd = 1的,现在的这个能求所有的。 设ans[i]表示gcd = i的集合数。 那么需要求ans[k],我们需要知道所有k、2*k、3*k......的元素的 阅读全文

posted @ 2017-07-17 23:53 stupid_one 阅读(137) 评论(0) 推荐(0) 编辑

Vijos 1002 过河 dp + 思维
摘要:https://www.vijos.org/p/1002 设dp[i]表示跳到了第i个点,需要的最小的步数。 所以复杂度O(L * T), 不行 注意到T最大是10, 所以dp[i]最多只由10项递推过来。 考虑上面的那个情况,如果两个相邻的石头距离大于10,那么其实是没意义的,比如上面那两个空的1 阅读全文

posted @ 2017-07-05 16:11 stupid_one 阅读(156) 评论(0) 推荐(0) 编辑

1137 - Sin your life sin公式 + 枚举
摘要:http://www.ifrog.cc/acm/problem/1137 和差化积公式, 变成2 * sin((x + y) / 2) * cos((x - y) / 2) + sin(n - (x + y)) 然后很重要的一个就是cos(x) = cos(-x) 这样,枚举x + y的取值i,当x 阅读全文

posted @ 2017-07-01 11:38 stupid_one 阅读(178) 评论(0) 推荐(0) 编辑

Sam's Numbers 矩阵快速幂优化dp
摘要:https://www.hackerrank.com/contests/hourrank-21/challenges/sams-numbers 设dp[s][i]表示产生的总和是s的时候,结尾符是i的所有合法方案数。 那么dp[s][i]可以由dp[s - i][1 m]中,abs(i - k) < 阅读全文

posted @ 2017-06-14 17:54 stupid_one 阅读(239) 评论(0) 推荐(0) 编辑

2017 ACM Arabella Collegiate Programming Contest div2的题,部分题目写个题解
摘要:F. Monkeying Around 维护点在多少个线段上 http://codeforces.com/gym/101350/problem/F 题意:有m个笑话,每个笑话的区间是[L, R],笑话种类有1e5,一开始所有猴子都在凳子上,听到一个笑话,就倒下,但是如果是听过的笑话,就重新回到凳子上 阅读全文

posted @ 2017-06-07 18:04 stupid_one 阅读(236) 评论(0) 推荐(0) 编辑

scau 18087 开始我是拒接的 mobius
摘要:其实有一个很有用的技巧就是,把gcd = 4的贡献,压去gcd = 2时的贡献,就不需要考虑这么多的了。 为什么可以把gcd = 4的,压去gcd = 2的呢,gcd = 12的,压去gcd = 6的去算呢, 其实这就是mobius的容斥原理,mu[4] = 0,mu[12] = 0, 例如: ht 阅读全文

posted @ 2017-05-29 23:52 stupid_one 阅读(395) 评论(0) 推荐(0) 编辑

D. Mike and distribution 首先学习了一个玄学的东西
摘要:http://codeforces.com/contest/798/problem/D D. Mike and distribution time limit per test 2 seconds memory limit per test 256 megabytes input standard 阅读全文

posted @ 2017-04-22 23:45 stupid_one 阅读(770) 评论(0) 推荐(0) 编辑

Gym - 101147J Whistle's New Car 树上差分
摘要:J. Whistle's New Car time limit per test 15 seconds memory limit per test 512 megabytes input car.in output standard output J. Whistle's New Car time 阅读全文

posted @ 2017-04-16 16:12 stupid_one 阅读(303) 评论(0) 推荐(0) 编辑

Codeforces Round #202 (Div. 1) A. Mafia 推公式 + 二分答案
摘要:http://codeforces.com/problemset/problem/348/A A. Mafia time limit per test 2 seconds memory limit per test 256 megabytes input standard input output 阅读全文

posted @ 2017-04-14 21:00 stupid_one 阅读(262) 评论(0) 推荐(0) 编辑

Codeforces Beta Round #12 (Div 2 Only) D. Ball 树状数组查询后缀、最值
摘要:http://codeforces.com/problemset/problem/12/D 这里的BIT查询,指的是查询[1, R]或者[R, maxn]之间的最值,这样就够用了。 设三个权值分别是b[1], b[2], b[2]; 首先,先把b[1]值离散化,离散成一个个id,那么只能是在id比较 阅读全文

posted @ 2017-04-10 19:39 stupid_one 阅读(226) 评论(0) 推荐(0) 编辑

ZOJ How Many Nines 模拟 | 打表
摘要:If we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y 阅读全文

posted @ 2017-04-09 22:20 stupid_one 阅读(352) 评论(0) 推荐(0) 编辑

计蒜客 翻硬币 数学题,
摘要:https://nanti.jisuanke.com/t/14897 描述: L用硬币玩游戏。他在n*m的矩阵中的每个小格中放一枚硬币,他想将所有的硬币都变成正面向上,但是,他给自己增加一些难度,他只能将整行或者整列的硬币都翻面。当然,他一点也不想做无用功,所以,他想知道当前的状态是否能通过一系列操 阅读全文

posted @ 2017-04-06 23:29 stupid_one 阅读(703) 评论(0) 推荐(0) 编辑

light OJ 1282 - Leading and Trailing 数学 || double技巧
摘要:http://lightoj.com/volume_showproblem.php?problem=1282 #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> # 阅读全文

posted @ 2017-03-20 00:02 stupid_one 阅读(212) 评论(0) 推荐(0) 编辑

B. Dispersed parentheses 记忆化搜索 + 括号序列的状压表示
摘要:http://codeforces.com/gym/100633/problem/B B. Dispersed parentheses time limit per test 2 seconds memory limit per test 256 megabytes input standard i 阅读全文

posted @ 2017-03-16 13:55 stupid_one 阅读(388) 评论(0) 推荐(0) 编辑

D - 連結 / Connectivity 并查集
摘要:http://abc049.contest.atcoder.jp/tasks/arc065_b 一开始做这题的时候,就直接蒙逼了,n是2e5,如果真的要算出每一个节点u能否到达任意一个节点i,这不是floyd吗?复杂度要达到n^3,bitset优化也没用了。然后想了想,肯定不是的,如果有很快的方法能 阅读全文

posted @ 2017-03-13 23:18 stupid_one 阅读(219) 评论(0) 推荐(0) 编辑

HDU 5808 Price List Strike Back bitset优化的背包。。水过去了
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5808 用bitset<120>dp,表示dp[0] = true,表示0出现过,dp[100] = true表示100这个数字出现过。 对于每一个新的数字,val,有转移方程, dp = dp | (dp << 阅读全文

posted @ 2017-03-05 21:42 stupid_one 阅读(180) 评论(0) 推荐(0) 编辑

1 2 下一页
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示