
Codeforces
LucienShui
因为孤独是人之常态,所以陪伴才显得格外可贵。
展开
-
Codeforces - 1166E - The LCMs Must be Large
Codeforces - 1166E - The LCMs Must be Large地址http://codeforces.com/contest/1166/problem/E原文地址https://www.lucien.ink/archives/434题目Dora the explorer has decided to use her money after several yea...原创 2019-05-19 03:43:16 · 746 阅读 · 0 评论 -
Codeforces 1076E - Vasya and a Tree - 树状数组
Codeforces 1076E - Vasya and a Tree - 树状数组题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/E题意给你一棵有根树,有 mmm 次操作,每次操作为 v d x,代表着把以 vvv 为根深度不超过 ddd 的所有点的权值都加上 xxx,问所有操作都进行完之后...原创 2018-12-22 17:28:26 · 350 阅读 · 0 评论 -
Codeforces 1076 - 题集
Codeforces 1076A - Minimizing the String题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/A题意你有一个字符串,你最多可以删掉一个字母,使得剩下的字符串的字典序最小。思路从左向右找到第一个当前字母小于下一个字母的位置,删掉这个字母即可。实现ht...原创 2018-12-22 17:31:59 · 324 阅读 · 0 评论 -
Codeforces 1087A - Right-Left Cipher
Codeforces 1087A - Right-Left Cipher题解链接https://lucien.ink题目链接http://codeforces.com/contest/1087/problem/A题意给你一个字符串 S=s1s2…snS = s_1s_2\dots s_nS=s1s2…sn,会将其一个一个地一左一右地放置为 S′=s5s3s1s2s4s6S&a...原创 2018-12-24 01:13:21 · 568 阅读 · 0 评论 -
Codeforces 1087B - Div Times Mod
Codeforces 1087B - Div Times Mod题解链接https://lucien.ink题目链接http://codeforces.com/contest/1087/problem/B题意给你一个 nnn、kkk ,找到一个最小的 xxx 使得 ⌊x÷k⌋⋅(x mod k)=n\lfloor x \div k \rfloor \cdot (...原创 2018-12-24 01:14:13 · 465 阅读 · 0 评论 -
Codeforces 1087C - Connect Three
Codeforces 1087C - Connect Three题解链接https://lucien.ink题目链接http://codeforces.com/contest/1087/problem/C题意有三个人在网格中,三个人的坐标互不相同,初始时所有网格都是白色的,你可以把任意多个网格染成黑色,染成黑色的网格可以相互连通(四连通),问至少需要对多少个网格进行染色,使得三个...原创 2018-12-24 01:14:57 · 1050 阅读 · 0 评论 -
Codeforces 1087D - Minimum Diameter Tree
Codeforces 1087D - Minimum Diameter Tree题解链接https://lucien.ink题目链接http://codeforces.com/contest/1087/problem/D题意你有一棵树,你可以给每条边一个非负的权值,使得整棵树的权值和为 sss ,定义这棵权值树的直径为权值和最大的一条路径,问最小直径为多少。思路翻译一下,其实...原创 2018-12-24 01:16:02 · 286 阅读 · 0 评论 -
Codeforces 1087 - 题集
Codeforces 1087A - Right-Left Cipher题解链接https://lucien.ink题目链接http://codeforces.com/contest/1087/problem/A题意给你一个字符串 S=s1s2…snS = s_1s_2\dots s_nS=s1s2…sn,会将其一个一个地一左一右地放置为 S′=s5s3s1s2s4s6S&a...原创 2018-12-24 01:17:01 · 429 阅读 · 3 评论 -
Codeforces - 1098A - Sum in the tree
地址https://codeforces.com/contest/1098/problem/A原文地址https://www.lucien.ink/archives/400/题意给出一棵有点权的树,跟节点深度为 111 ,现在你只知道深度为奇数的点到数根的路经权值和,让你给所有点都分配一个非负的权值,满足所给和,且所有点权的和最小。如果不存在输出 −1-1−1 。题解对于权值和未知的...原创 2019-03-11 22:35:16 · 388 阅读 · 0 评论 -
Codeforces 1076D - Edge Deletion - 思维
Codeforces 1076D - Edge Deletion - 思维题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/D题意有一个 nnn 个点 mmm 条边的无向图 G&lt;n,m&gt;G&lt;n, m&gt;G<n,m>,定义 dist...原创 2018-12-22 17:27:21 · 448 阅读 · 0 评论 -
Codeforces 1076C - Meme Problem
Codeforces 1076C - Meme Problem题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/C题意给你一个非负整数 ddd ,你要找到两个非负的自然数 aaa、bbb,使得 a+b=da + b = da+b=d 和 a⋅b=da \cdot b = da⋅b=d 同时成立,...原创 2018-12-22 17:25:50 · 306 阅读 · 0 评论 -
Codeforces 1084A - The Fair Nut and Elevator
Codeforces 1084A - The Fair Nut and Elevator题解链接https://lucien.ink题目链接https://codeforces.com/contest/1084/problem/A题意 有一个电梯,它初始时会停留在第 kkk 层楼,每当有一个人要从第 aaa 楼去第 bbb 楼,电梯就会始终按照 k→a→b→kk \rightar...原创 2018-12-11 04:53:26 · 699 阅读 · 6 评论 -
Codeforces 1084B - Kvass and the Fair Nut - 二分
Codeforces 1084B - Kvass and the Fair Nut - 二分题解链接https://lucien.ink题目链接https://codeforces.com/contest/1084/problem/B题意 你有 nnn 桶水,第 iii 桶水里初始时有 viv_ivi 升水,你需要从这 nnn 桶水中取出 sss 升水,问是否能取 sss 升水...原创 2018-12-11 04:54:26 · 527 阅读 · 0 评论 -
Codeforces 1084C - The Fair Nut and String
Codeforces 1084C - The Fair Nut and String题解链接https://lucien.ink题目链接https://codeforces.com/contest/1084/problem/C题意 给你一串字符串,问你能选出多少个形如 aba 这样的子序列(任意两个 a 之间至少包含一个 b),a 也算,aba 与 abba 与 ab*ba 算同...原创 2018-12-11 04:55:13 · 535 阅读 · 0 评论 -
Codeforces 1084D - The Fair Nut and the Best Path - 树形DP
Codeforces 1084A - The Fair Nut and the Best Path - 树形DP题解链接https://lucien.ink题目链接https://codeforces.com/contest/1084/problem/D题意 给你一棵树,数上的每个点都有一个正权值,每条边都有一个负权值,让你在树中找一条简单路径,使得权值和最大。思路 我们...原创 2018-12-11 04:57:36 · 651 阅读 · 0 评论 -
Codeforces 1084E - The Fair Nut and Strings - 思维
Codeforces 1084E - The Fair Nut and Strings - 思维题解链接https://lucien.ink题目链接https://codeforces.com/contest/1084/problem/E题意 给你一个区间 [s,t][s, t][s,t],其中 sss 和 ttt 都是字符串,且长度为 nnn,只包含 ab 两种字符,问从这个...原创 2018-12-11 04:58:41 · 799 阅读 · 0 评论 -
Codeforces 1084 - 题集
单个题目的链接Codeforces 1084A - The Fair Nut and ElevatorCodeforces 1084B - Kvass and the Fair Nut - 二分Codeforces 1084C - The Fair Nut and StringCodeforces 1084D - The Fair Nut and the Best Path - 树形DP...原创 2018-12-11 05:02:01 · 739 阅读 · 0 评论 -
Codeforces 1076A - Minimizing the String
Codeforces 1076A - Minimizing the String题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/A题意你有一个字符串,你最多可以删掉一个字母,使得剩下的字符串的字典序最小。思路从左向右找到第一个当前字母小于下一个字母的位置,删掉这个字母即可。实现ht...原创 2018-12-22 17:24:18 · 268 阅读 · 0 评论 -
Codeforces 1076B - Divisor Subtraction
Codeforces 1076B - Divisor Subtraction题解链接https://lucien.ink题目链接http://codeforces.com/contest/1076/problem/B题意你有一个程序 f(n)f(n)f(n):如果 n=0n = 0n=0 结束程序找到 nnn 的最小质因数 dddn=n−dn = n - dn=n−d ,然...原创 2018-12-22 17:25:03 · 1300 阅读 · 0 评论 -
Codeforces - 1098B - Nice table
地址https://codeforces.com/contest/1098/problem/A原文地址https://www.lucien.ink/archives/401/题意给你一个表格,上面只有四种字符 ATCGATCGATCG 。你可以把任意位置上的字符替换成这四种中的一种,问所有满足在替换之后对于每个 2⋅22 \cdot 22⋅2 的正方形四种字符全部都出现的表格中,且和原...原创 2019-03-11 22:44:31 · 379 阅读 · 0 评论 -
Codeforces - 1098C - Construct a tree
地址https://codeforces.com/contest/1098/problem/C原文地址https://www.lucien.ink/archives/402/题意能否构造出一棵 nnn 个节点的树,使得以每个点为根的子树的 sizesizesize 加起来等于 sss ,如果能,输出使得儿子最多的点的儿子数目最少的那种。题解不难看出,以每个点为根的子树的 sizesi...原创 2019-03-11 22:52:01 · 248 阅读 · 0 评论 -
Codeforces - 1155D - Beautiful Array
地址https://codeforces.com/contest/1155/problem/D原文地址https://www.lucien.ink/archives/420/题意你有一个长为 nnn 的序列,你可以选择一个子区间(可以为空),将这个子区间所有的元素乘以 xxx ,问做完上述操作之后这个序列的最大连续区间和可以是多少。题解记状态为 f[i][status] ,其中 st...原创 2019-04-23 15:54:06 · 351 阅读 · 0 评论 -
Codeforces - 1152A - Neko Finds Grapes
地址https://codeforces.com/contest/1152/problem/A原文地址https://www.lucien.ink/archives/421/题意有 nnn 把锁 mmm 把钥匙,如果锁 AAA 和钥匙 BBB 的权值加起来是一个奇数,那么 AAA 和 BBB 就可以配对,问最多能配多少对。代码https://pasteme.cn/6825#incl...原创 2019-04-25 00:48:55 · 369 阅读 · 0 评论 -
Codeforces - 1152B - Neko Performs Cat Furrier Transform
地址https://codeforces.com/contest/1152/problem/B原文地址https://www.lucien.ink/archives/422/题意给你一个 xxx ,让你在 404040 步之内把它变成 2n−12 ^ n - 12n−1 的形式,你一定会在奇数步将其异或上一个值 2k−12 ^ k - 12k−1 ,在偶数步将其自增 111 ,让你输出你...原创 2019-04-25 00:49:30 · 625 阅读 · 0 评论 -
Codeforces - 1152C - Neko does Maths
地址https://codeforces.com/contest/1152/problem/C原文地址https://www.lucien.ink/archives/423/题意给你 aaa 和 bbb ,找到一个最小的 kkk ,使得 lcm(a+k,b+k)lcm(a + k, b + k)lcm(a+k,b+k) 最小。题解不妨设 a>ba > ba...原创 2019-04-25 00:58:47 · 541 阅读 · 0 评论 -
Codeforces - 1166A - Silent Classroom
Codeforces - 1166A - Silent Classroom地址http://codeforces.com/contest/1166/problem/A原文地址https://www.lucien.ink/archives/430题目There are nnn students in the first grade of Nlogonia high school. The...原创 2019-05-19 02:25:14 · 479 阅读 · 0 评论 -
Codeforces - 1166B - All the Vowels Please
Codeforces - 1166B - All the Vowels Please地址http://codeforces.com/contest/1166/problem/B原文地址https://www.lucien.ink/archives/431题目Tom loves vowels, and he likes long words with many vowels. His f...原创 2019-05-19 02:28:43 · 637 阅读 · 0 评论 -
Codeforces - 1166C - A Tale of Two Lands
Codeforces - 1166C - A Tale of Two Lands地址http://codeforces.com/contest/1166/problem/C原文地址https://www.lucien.ink/archives/432题目The legend of the foundation of Vectorland talks of two integers xx...原创 2019-05-19 02:54:16 · 635 阅读 · 0 评论 -
Codeforces - 1166D - Cute Sequences
Codeforces - 1166D - Cute Sequences地址http://codeforces.com/contest/1166/problem/D原文地址https://www.lucien.ink/archives/433题目Given a positive integer mmm, we say that a sequence x1,x2,…,xnx_1, x_2,...原创 2019-05-19 03:26:27 · 869 阅读 · 0 评论 -
Codeforces - 1155C - Alarm Clocks Everywhere
地址https://codeforces.com/contest/1155/problem/C原文地址https://www.lucien.ink/archives/419/题意你有 nnn 个事件,第 iii 个事件需要在第 xix_ixi 时刻去做,你是一个机器人,你只能选定任意一个起始时间 yyy ,然后从给定的 mmm 个数字中选出一个 pip_ipi ,然后你从第 yyy ...原创 2019-04-23 15:47:45 · 352 阅读 · 0 评论 -
Codeforces - 1155B - Game with Telephone Numbers
地址https://codeforces.com/contest/1155/problem/B原文地址https://www.lucien.ink/archives/418/题意如果一个纯数字的串长度为 111111 且以数字 888 开头,那么这个串就是一个好串,给你一个纯数字的串 sss ,你和另一个人轮流从中任意删掉一个数字,你先手,直到这个串的长度变为 111111 ,如果最后的...原创 2019-04-23 15:38:38 · 371 阅读 · 0 评论 -
Codeforces - 1139A - Even Substrings
地址https://codeforces.com/contest/1139/problem/A原文地址https://www.lucien.ink/archives/406题意给你一个只包含数字的字符串,问有多少个子串是偶数。代码https://pasteme.cn/4937#include <bits/stdc++.h>typedef long long ll;c...原创 2019-03-25 01:27:57 · 239 阅读 · 0 评论 -
Codeforces - 1139B - Chocolates
地址https://codeforces.com/contest/1139/problem/B原文地址https://www.lucien.ink/archives/407题意你有 nnn 堆物品,第 iii 堆物品有 aia_iai 个,如果你要从第 iii 堆物品中取走 xix_ixi 个,那么对于 1≤j<i1 \leq j < i1≤j<i ...原创 2019-03-25 01:28:34 · 284 阅读 · 0 评论 -
Codeforces - 1139C - Edgy Trees
地址https://codeforces.com/contest/1139/problem/C原文地址https://www.lucien.ink/archives/408题解容斥一下。代码https://pasteme.cn/4939#include <bits/stdc++.h>typedef long long ll;const int maxn = int(...原创 2019-03-25 01:29:47 · 322 阅读 · 0 评论 -
Codeforces - 1139D - Steps to One
地址https://codeforces.com/contest/1139/problem/D原文地址https://www.lucien.ink/archives/409题意模拟一个循环,一开始有一个空序列,之后每次循环:从 [1,m][1, m][1,m] 中等概率选出一个数字添加到序列里去。检查这个序列所有元素的 gcdgcdgcd 是否为 111,如果为 111 则停...原创 2019-03-25 01:31:05 · 725 阅读 · 0 评论 -
Codeforces - 1139E - Maximize Mex
地址https://codeforces.com/contest/1139/problem/E原文地址https://www.lucien.ink/archives/410题意nnn 个点,mmm 个集合,每个点都有一个权值,且只属于一个集合,每次你可以从每个集合中选定至多一个点,你的目标是使这些选出来的点权值的 MexMexMex 最大。有 ddd 个询问,每个询问的为一个数字 kkk...原创 2019-03-26 01:28:42 · 537 阅读 · 0 评论 -
Codeforces - 1153C - Serval and Parenthesis Sequence
地址https://codeforces.com/contest/1153/problem/C原文地址https://www.lucien.ink/archives/415代码https://pasteme.cn/6250#include <bits/stdc++.h>const int maxn = int(1e6) + 7;int len, left, right;...原创 2019-04-15 00:06:56 · 270 阅读 · 0 评论 -
Codeforces - 1153D - Serval and Rooted Tree
地址https://codeforces.com/contest/1153/problem/D原文地址https://www.lucien.ink/archives/416代码https://pasteme.cn/6251#include <bits/stdc++.h>const int maxn = int(3e5) + 7;std::vector<int>...原创 2019-04-15 00:09:48 · 438 阅读 · 0 评论 -
Codeforces - 1155A - Reverse a Substring
地址https://codeforces.com/contest/1155/problem/A原文地址https://www.lucien.ink/archives/417/题意给你一个串 sss ,问能否翻转一个区间使得它的字典序变小。题解先 sort 一下判断是否可以,可以的话枚举一下。代码https://pasteme.cn/6687#include <bits/s...原创 2019-04-23 15:30:21 · 358 阅读 · 0 评论 -
Codeforces 1080 - 全解
单个题目的链接Codeforces 1080A - Petya and OrigamiCodeforces 1080B - Margarite and the best presentCodeforces 1080C - Masha and two friendsCodeforces 1080D - Olya and magical squareCodeforces 1080E - So...原创 2018-12-09 02:01:18 · 851 阅读 · 0 评论