摘要: 树状数组基本模板 lowbit 1 inline int lowbit(int x) 2 { 3 return x & (-x); 4 } 单点修改 1 inline void update(int i, int x) 2 { 3 for (int pos = i; pos < MAXN; pos 阅读全文
posted @ 2021-03-24 14:04 icey_z 阅读(276) 评论(0) 推荐(0)
摘要: Square-free division (easy version) This is the easy version of the problem. The only difference is that in this version k=0. There is an array a1,a2, 阅读全文
posted @ 2021-03-19 20:49 icey_z 阅读(150) 评论(0) 推荐(0)
摘要: Square-free division (easy version) This is the easy version of the problem. The only difference is that in this version k=0. There is an array a1,a2, 阅读全文
posted @ 2021-03-19 17:20 icey_z 阅读(131) 评论(0) 推荐(0)
摘要: K-beautiful Strings You are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase Engli 阅读全文
posted @ 2021-03-07 18:48 icey_z 阅读(323) 评论(0) 推荐(0)
摘要: C. Floor and Mod A pair of positive integers \( (a,b) \) is called special if \(\lfloor \frac{a}{b} \rfloor = a \bmod b \). Here, \( \lfloor \frac{a}{ 阅读全文
posted @ 2021-02-14 00:06 icey_z 阅读(133) 评论(0) 推荐(0)
摘要: Searching Local Minimum This is an interactive problem. Homer likes arrays a lot and he wants to play a game with you. Homer has hidden from you a per 阅读全文
posted @ 2021-02-08 19:21 icey_z 阅读(154) 评论(0) 推荐(0)
摘要: P1908 逆序对 https://www.luogu.com.cn/problem/P1908 题目描述 猫猫 TOM 和小老鼠 JERRY 最近又较量上了,但是毕竟都是成年人,他们已经不喜欢再玩那种你追我赶的游戏,现在他们喜欢玩统计。 最近,TOM 老猫查阅到一个人类称之为“逆序对”的东西,这东 阅读全文
posted @ 2021-02-07 13:18 icey_z 阅读(211) 评论(0) 推荐(0)
摘要: E. 只有一端开口的瓶子 https://codeforces.com/gym/102174/problem/E 栈就是像 "只有一端开口的瓶子" 一样的数据结构,大家可以理解为一个头部固定的数组,无论是取出数字还是放入数字,你都只能在数组末尾那一端(称为栈顶)修改。 非常喜欢数据结构的周老师又在给 阅读全文
posted @ 2021-02-07 00:59 icey_z 阅读(133) 评论(0) 推荐(0)
摘要: C. 亦或骗子 https://codeforces.com/gym/102889/problem/C 问题描述 对于非负整数 u, v 的异或 ,w 二进制下第 i 位为 1,当且仅当 u 和 v 二进制下的第 i 位不相同。 非负整数 x 的 ,定义为 x 二进制下 1 的个数,比如 , , 。 阅读全文
posted @ 2021-02-06 23:56 icey_z 阅读(135) 评论(0) 推荐(0)
摘要: 背包问题初步 背包问题(Knapsack problem)是一种组合优化的NP完全问题。问题可以描述为:给定一组物品,每种物品都有自己的重量和价格,在限定的总重量内,我们如何选择,才能使得物品的总价格最高。问题的名称来源于如何选择最合适的物品放置于给定背包中。相似问题经常出现在商业、组合数学,计算复 阅读全文
posted @ 2021-02-06 12:56 icey_z 阅读(160) 评论(0) 推荐(0)