B. Bear and Displayed Friends 题目连接: http://www.codeforces.com/contest/658/problem/B Description Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is describ…
C. Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A tree is a connected undirected graph consisting of n vertices and n  -  1 edges. Vertices are numbered 1 thro…
题目链接: http://codeforces.com/contest/673/problem/D 题意: 给四个不同点a,b,c,d,求是否能构造出两条哈密顿通路,一条a到b,一条c到d. 题解: 构造法,看例子: input: 5 6 5 2 4 1 output: 5 4 3 1 2 4 5 3 2 1 所以只要满足k>=n+1,就可以构造出来答案. #include<iostream> #include<cstring> #include<cstdio>…
题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; ; const int…
D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same p…
C. Bear and Colors 题目连接: http://www.codeforces.com/contest/673/problem/C Description Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n.…
A. Bear and Game 题目连接: http://www.codeforces.com/contest/673/problem/A Description Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks. Each minute can be either interesting or…
E. Bear and Contribution 题目连接: http://www.codeforces.com/contest/658/problem/E Description Codeforces is a wonderful platform and one its feature shows how much someone contributes to the community. Every registered user has contribution - an integer…
D. Bear and Polynomials 题目连接: http://www.codeforces.com/contest/658/problem/D Description Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials. He considers a polynomial valid if its degree is n and its coe…
C. Bear and Forgotten Tree 3 题目连接: http://www.codeforces.com/contest/658/problem/C Description A tree is a connected undirected graph consisting of n vertices and n  -  1 edges. Vertices are numbered 1 through n. Limak is a little polar bear and Rade…