随笔分类 - Codeforces
这里汇聚了我在Codeforces的刷题记录
摘要:codeforces1461D-Divide and Summarize 题目链接 题目描述: 给定n个数组成的数列,选择一个mid值为当前数列中最大值与最小值之和除以二(向下取整),将这个数列分割为全部元素小于等于mid的一个数列和大于mid的另一个数列,数列内部的元素保持在原数列中的相对顺序,并
阅读全文
摘要:codeforces1430E-String Reversal 题目链接:http://codeforces.com/contest/1430/problem/E 题目描述: 给定一个字符串(abcd),将该字符串转换为它的反转字符串(dcba),只可以交换相邻的字符,问一共需要交换多少次 思路:
阅读全文
摘要:Weights Distributing 题目链接:https://codeforces.com/contest/1343/problem/E 题目描述: 给定n个点m条无向边,再给你a,b,c三个点和m个值,现在要求你将这m个值分配这m条边,使a->b->c的路径的权值最小 思路: 分类讨论,一种
阅读全文
摘要:Directing Edges 题目描述: 给定n个点m条边,其中一些边是有向的,一些边是无向的,现在你需要将这些无向的边确定方向,并判断是否可以生成一个有向无环图 思路: 显而易见如果给出的有向边没有形成环的话,剩下的无向边一定可以使他们不形成环,于是只需要将给定的有向边做一遍拓扑排序,判断是否已
阅读全文
摘要:Same GCDs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given two integers a a
阅读全文
摘要:Christmas Trees time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are n Christmas trees
阅读全文
摘要:Dr. Evil Underscores time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Today, as a friendship g
阅读全文