CodeForces Round #550 Div.3】的更多相关文章

http://codeforces.com/contest/1144 A. Diverse Strings A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", &qu…
        F. Graph Without Long Directed Paths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a connected undirected graph consisting of nn vertices and mm edges. There are no…
D. Equalize Them All time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array aa consisting of nn integers. You can perform the following operations arbitrary number of times…
F. Graph Without Long Directed Paths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a connected undirected graph consisting of nn vertices and mm edges. There are no self-lo…
Median String time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given two strings ss and tt, both consisting of exactly kk lowercase Latin letters, ss is lexicographically less than …
D. Equalize Them All time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array aa consisting of nn integers. You can perform the following operations arbitrary number of times…
A. Diverse Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exac…
把字符串看作是26进制的数,从后往前翻译,那么就可以把两个串变成对应的26进制的数字,那么只要把两个数加起来除以二就得到中间的串对应的数了,同理再转化回来就行了.但是这样会有一个问题就是串的长度有2e5,26的2e5次方显然不可求,所以需要对每一位进行手动的加和运算.对于两个串,我们假设a串从后往前的每一位对应的数值为a0, a1, a2...,b串从后往前的每一位对应的数值为b0, b1, b2...对于进制加法,有 扔一下垃圾代码: #include <iostream> #include…
题意:给你两个字符串\(s\)和\(t\),保证\(t\)的字典序大于\(s\),求他们字典序中间的字符串. 题解:我们假设题目给的不是字符串,而是两个10禁止的正整数,那么输出他们之间的数只要把他两加起来除\(2\)就行了,那么对于字符串又为何不可呢?我们可以将每个字母看成\(26\)进制的数,像高精度那样模拟加法运算的过程,然后再模拟除\(2\)的过程即可. 代码: int k; string s,t; int c[N]; int d[N]; int main() { ios::sync_w…
题意:有\(n\)个点和\(m\)条无向边,现在让你给你这\(m\)条边赋方向,但是要满足任意一条边的路径都不能大于\(1\),问是否有满足条件的构造方向,如果有,输出一个二进制串,表示所给的边的方向. 题解:我们先单独拿出\(3\)个点来看,选择一个点,那么与它相连的另外两个点到自己的方向一定是相同的,同理,我们可以推广到任意一个点,与它相连的所有点到它的方向必须都是一样的才行,其实到这儿就不难看出可以用二分图染色来写了,然后打个板子就能很愉快的AC啦~ 代码: int n,m; int a,…