CF679E Bear and Bad Powers of 42 题意 定义一个正整数是坏的,当且仅当它是 $42$ 的次幂,否则它是好的。 给定一个长度为 $n$ 的序列 $a_i$,保证初始时所有数都是好的。 有 $q$ 次操作,每次操作有三种...
题解
CF594E Cutting the Line 题解
CF594E Cutting the Line 做法来自 wucstdio 神仙的题解,表述经过了一定的修改,也许会好懂一些? 题意 给定一个字符串 $s$ 和一个正整数 $k$。 你可以将 $s$ 分成至多 $k$ 段,并将每一段翻转或者不翻...
Codeforces Round #623 (Div. 1, based on VK Cup 2019-2020 – Elimination Round, Engine) 题解
Codeforces Round #623 (Div. 1, based on VK Cup 2019-2020 - Elimination Round, Engine) Recommendations 用堆贪心。 const int N = 2e5 + 7; int n; ll s, ans; pair<ll, ll> p[N]; int main()...
Codeforces Round #622 (Div. 2) 题解
Codeforces Round #622 (Div. 2) Fast Food Restaurant 贪心。 inline void solve() { int a, b, c; rd(a), rd(b), rd(c); int ans = 0; if (a) ++ans, --a; if (b) ++ans, --b; ...
CF575E Spectator Riots 题解
CF575E Spectator Riots 题意 给定整点集 $\mathcal S = \{(x,y)|x,y \in [0,10^5]\}$。 给定另外 $n$ 个整点集 $\mathcal P_{1\dots n}$,对于 $i \in [1,n]$,给定 $x_i,y_i,v_i$,$\mathcal P_...
CF607E Cross Sum 题解
CF607E Cross Sum 题意 在平面直角坐标系中,给定 $n$ 条不同的直线,第 $i$ 条直线为 $y=a_i x+b_i$。 可重点集 $\mathcal I$ 为 $n$ 条直线两两的交点,可重数集 $\mathcal D$ 为 $\mathcal I$ 中所有点...
Codeforces Round #621 (Div. 1 + Div. 2) 题解
Codeforces Round #621 (Div. 1 + Div. 2) Cow and Haybales 贪心。 const int N = 107; int n, d, a[N]; inline void solve() { rd(n), rd(d); for (int i = 1; i <= n; i++) rd(a[i]); ...
CF506E Mr. Kitayuta’s Gift 题解
CF506E Mr. Kitayuta's Gift 题意 给定一个小写字符串 $s$ 和一个正整数 $n$。 要求在 $s$ 中插入恰好 $n$ 个小写字符使其回文的方案数。 $|s| \le 200$,$n \le 10^9$,答案对 $10^4 + 7$ 取模。 题解 ...
CF571E Geometric Progressions 题解
CF571E Geometric Progressions 题意 给定 $n$ 以及 $n$ 个正整数对 $a_i, b_i$。 第 $i$ 对 $a_i, b_i$ 确定了一个序列 ${a_i, a_i b_i, a_i b_i^2, a_i b_i^3, \ldots }$。 询问最小的在 $n$ ...
CF627F Island Puzzle 题解
CF627F Island Puzzle 题意 给定一棵 $n$ 个点的树,每个点上都有一个 $[0,n-1]$ 的数,任意两点上的数都不同。 每次你可以交换 $0$ 所在的点和与其相连的任一点上的数,同时你可以最多加入一条边。 给定...