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…
        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…
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…
You are given a connected undirected graph consisting of nn vertices and mm edges. There are no self-loops or multiple edges in the given graph. You have to direct its edges in such a way that the obtained directed graph does not contain any paths of…
题意:有\(n\)个点和\(m\)条无向边,现在让你给你这\(m\)条边赋方向,但是要满足任意一条边的路径都不能大于\(1\),问是否有满足条件的构造方向,如果有,输出一个二进制串,表示所给的边的方向. 题解:我们先单独拿出\(3\)个点来看,选择一个点,那么与它相连的另外两个点到自己的方向一定是相同的,同理,我们可以推广到任意一个点,与它相连的所有点到它的方向必须都是一样的才行,其实到这儿就不难看出可以用二分图染色来写了,然后打个板子就能很愉快的AC啦~ 代码: int n,m; int a,…
B. Complete The Graph time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge…
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…
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…