摘要: 灵茶之二分01 链接 Problem - 166C - Codeforces 题目大意 输入 n(1≤n≤500) x(1≤x≤\(10^5\)) 和长为 n 的数组 a(1≤a[i]≤\(10^5\))。 向 a 中添加尽量少的数,使得 a 的中位数恰好等于 x。 输出添加的元素个数。 注:如果 阅读全文
posted @ 2024-03-26 18:38 gebeng 阅读(23) 评论(0) 推荐(0)
摘要: 灵茶之贪心模拟01 题目链接 https://codeforces.com/problemset/problem/1443/B 题目大意 输入 T(≤\(10^5\)) 表示 T 组数据。所有数据的字符串长度之和 ≤ \(10^5\)。 每组数据输入 a(1≤a≤1000) b(1≤b≤1000) 阅读全文
posted @ 2024-03-26 12:31 gebeng 阅读(27) 评论(0) 推荐(0)
摘要: 与普通线段树并无其他区别,只不过存储的信息是每个值出现的次数罢了 理解图 import sys input = lambda: sys.stdin.readline() class Tree: def __init__(self, N): self.cnt = [0 for _ in range(N 阅读全文
posted @ 2024-03-26 12:29 gebeng 阅读(24) 评论(0) 推荐(0)