Codeforces Round #484 (Div. 2)】的更多相关文章

Codeforces Codeforces Round #484 (Div. 2) E. Billiard 题目连接: http://codeforces.com/contest/982/problem/E Description Consider a billiard table of rectangular size $n \times m$ with four pockets. Let's introduce a coordinate system with the origin at t…
Codeforces Codeforces Round #484 (Div. 2) D. Shark 题目连接: http://codeforces.com/contest/982/problem/D Description For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and…
题目链接:http://codeforces.com/contest/982 A. Row time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You're given a row with nn chairs. We call a seating of people "maximal" if the two follow…
原博主:https://blog.csdn.net/amovement/article/details/80358962 B. Bus of Characters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Bus of Characters there are nn rows of seat, each h…
题目链接 题意:给你一棵树,让你尽可能删除多的边使得剩余所有的联通组件都是偶数大小. 思路:考虑dfs,从1出发,若当前节点的子节点和自己的数目是偶数,说明当前节点和父亲节点的边是可以删除的,答案+1,因为最开始的节点没有父节点,所以最后答案-1 #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mp make_pair #define pb push_back usi…
题意:给你一个台球桌面,一个台球的初始位置和初始速度方向(只可能平行坐标轴或者与坐标轴成45度角),问你能否滚进桌子四个角落的洞里,如果能,滚进的是哪个洞. 如果速度方向平行坐标轴,只需分类讨论,看它是否在台球桌的边沿即可. 如果速度方向和坐标轴成45度,如下图 将整个过程展开, 设出射方向与当前所在桌面的两个边沿的距离分别为X,Y,则有方程X+pn=Y+qm,扩欧可求得解.然后再根据p.q的奇偶性即可确定滚进的是哪个洞(根据图中洞编号的翻折关系).…
题意:给你一个序列,让你找一个k,倘若把大于等于k的元素都标记为不可用,那么剩下的所有元素形成的段的长度相同,并且使得段的数量尽量大.如果有多解,输出k尽量小的. 把元素从大到小排序插回原位置,用一个set维护前驱后继,相当于删除一个原有的段,然后将这个段切成两半,产生两个新的段.维护这次操作后所有段的长度以及各种长度的出现次数(用multiset),一旦合法,就尝试更新答案. #include<cstdio> #include<algorithm> #include<set…
题意:给你一棵树,让你切掉尽可能多的边,使得产生的所有连通块都有偶数个结点. 对于一棵子树,如果它有奇数个结点,你再从里面怎么抠掉偶数结点的连通块,它都不会变得合法.如果它本来就有偶数个结点,那么你怎么抠,都是合法的. 所以,我们只需要切断所有有偶数结点的子树的父边即可. 然后再判一遍最后是否仍是合法的. #include<cstdio> #include<cstring> using namespace std; int n; int e,first[100005],nex[20…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…