题目链接: http://codeforces.com/problemset/problem/301/B B. Yaroslav and Time time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Yaroslav is playing a game called "Time". The game has a timer showing the lifespan he's got left. As s…
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其中n个元素改变符号,你的目的是使得最后所有数的和尽量大,问你答案是多少 题解: 感觉上就是构造题,手动玩一玩就知道,当n为奇数的时候,你可以通过三次操作,使得只会改变一个负数的符号.同理n为偶数的时候,每次要改变两个负数的符号. 所以答案如下: 当n为奇数的时候,答案为所有数的绝对值和 当n为偶数的…
题目链接 Description Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i andj(1 ≤ i, j ≤ n), such that si > wi and sj < wj. Here sign si represents the i-th digit of string s,…
A. Eugeny and Array \(r-l+1\)是奇数时,和显然无法为0. 奇数的情况需要判断-1和1的个数是否大于等于长度的一半. B. Eugeny and Play List 模拟. C. Yaroslav and Sequence 当负数个数和\(n\)同奇偶时,所有数都可以转化成整数.(随便拿n-1个数和其中一个负数操作,然后再拿另一个负数和这n-1个数再操作即可).同奇偶,可以转变负数个数. 当负数为偶数时,最后都会变成整数. 否则,最后剩下一个负数时,与整数的最小值对换,…
题目链接: http://codeforces.com/contest/567/problem/E 题意: 给你一个带重边的图,求三类边: 在最短路构成的DAG图中,哪些边是必须经过的: 其他的(包括不在DAG上的边)不是必须经过的边把权值改小多少才能通过, 或者根本不可能通过的. 题解: 从起点s跑一遍最短路得到d[maxn],从终点t跑一遍最短路得到d2[maxn],对于边(u,v,w),如果d[u]+d2[v]+w==d[t]那么这条边在最短路上,对于不在最短路上的边,如果d[u]+d2[…
B. World Tour 题目连接: http://www.codeforces.com/contest/666/problem/B Description A famous sculptor Cicasso goes to a world tour! Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he…
题目链接: 题目 E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes inputstandard input outputstandard output 问题描述 Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important…
E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving…
传送门 E. Breaking Good time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is real…
D. World Tour   A famous sculptor Cicasso goes to a world tour! Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will en…