VK Cup 2016 D. Bear and Two Paths 模拟】的更多相关文章

D. Bear and Two Paths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two dist…
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…
D. Bear and Two Paths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two dist…
题目链接: 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>…
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…
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…
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…
A. Bear and Reverse Radewoosh 题目连接: http://www.codeforces.com/contest/658/problem/A Description Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in…
A. Bear and Reverse Radewoosh time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equa…
题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; ; const int…
C. Bear and Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n…
A. Bear and Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no break…
连接在这里,->点击<- A. Bear and Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and ther…
A - Little Artem and Presents (div2) 1 2 1 2这样加就可以了 #include <bits/stdc++.h> typedef long long ll; const int N = 1e5 + 5; int main() { int n; scanf ("%d", &n); int ans = n / 3 * 2; if (n % 3) { ans++; } printf ("%d\n", ans);…
A.暴力枚举,注意游戏最长为90分钟 B.暴力,c[l]++,c[r]--,记录中间有多长的段是大小为n的,注意特判m=0的情况 C.暴力枚举,我居然一开始没想出来!我一直以为每次都要统计最大的,就要O(N^3).实际上只要判断最大的那个. D.构造,在除了a,b,c,d之外的点构造一条链,只需要n+1条边就可以了.n=4的时候特判.…
题目链接: http://codeforces.com/contest/669/problem/D 题意: 给你一个初始序列:1,2,3,...,n. 现在有两种操作: 1.循环左移,循环右移. 2.1,2位置交换,3,4位置交换,...,n-1,n位置交换 现在问执行了q次操作之后序列是什么,每次操作可以是两种操作的任意一种 题解: 我们把数列按位置的奇偶分为两堆,无论哪种操作,始终都还是这两堆,最多就是整堆的对换和一个堆内部的偏移. 所以我们只要记录第一个位置和第二个位置的数的变化(相当于每…
昨天第一次开大小号打cf,发现原来小号提交之后大号在此提交同样的代码会被skipped掉,然后之后提交的代码都不记分,昨天a,b,c都是水题 A 题意:问一个物品最多能被分成多少份,分成的连续两份不能相同 分析:直接1,2这样份,所以除以3乘2,在对3取模 #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #in…
今天在codeforces上面做到一道题:http://codeforces.com/contest/638/problem/B 题目大意是:给定n个字符串,找到最短的字符串S使得n个字符串都是这个字符串S的子串. 题目里有一个限制条件是每个字母都最多出现一次,所以可以用下面的方法来解决: http://codeforces.com/contest/638/submission/16900955 然后我想到如果问题没有“每个字母最多只出现一次”这个限制的话应该怎么解决. 暂时还在想………
B. Problems for Round 题目连接: http://www.codeforces.com/contest/673/problem/B Description There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficult…
C. Little Artem and Random Variable 题目连接: http://www.codeforces.com/contest/668/problem/C Description Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them. Cons…
E. Little Artem and Time Machine 题目连接: http://www.codeforces.com/contest/669/problem/E Description Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply thi…
D. Little Artem and Dance 题目连接: http://www.codeforces.com/contest/669/problem/D Description Little Artem is fond of dancing. Most of all dances Artem likes rueda - Cuban dance that is danced by pairs of boys and girls forming a circle and dancing tog…
C. Little Artem and Matrix 题目连接: http://www.codeforces.com/contest/669/problem/C Description Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new contro…
B. Little Artem and Grasshopper 题目连接: http://www.codeforces.com/contest/669/problem/B Description Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him. The area looks like a strip of cells 1 × n. Each ce…
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the prese…
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Description A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepip…