B. Beggin' For A Node time limit per test2.0 s memory limit per test256 MB inputstandard input outputstandard output This is an interactive problem Low_ has a beautiful tree, which he keeps very carefully. A tree is a tree, but mathematically, it cou…
题目链接:http://codeforces.com/gym/102279/problem/H 大致题意: 你在一个定点,你有个长度为R的钩子,有n个东西在其他点处,问你能勾到的东西的数量是多少? 思路:明明一道几何题,罗老板居然用gcd巧妙的A了,真是太强了.如果一件物品挡住了另一件物品,那么它是勾不到的. 首先将所有距离在R的点都拎出来,然后对于给定点进行极角排序,最后俩俩相邻比较即可确定答案. AC代码: #include<cmath> #include<cstdio> #i…
题目链接: 题目 D. Kay and Snowflake time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output 问题描述 After the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the r…
C - Upgrading Tree 我发现我构造题好弱啊啊啊. 很明显能想到先找到重心, 然后我们的目标就是把所有点接到重心的儿子上,让重心的儿子子树变成菊花图, 这个先把重心到儿子的边连到 i , 然后把 i 到 其 fa 的边连到重心的儿子上, 一直循环就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL p…
E. The penguin's game time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Pay attention: this problem is interactive. Penguin Xoriy came up with a new game recently. He has n icicles number…
题目链接 Problem Description In ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated in the following way. First let's ignore all the problems the team didn't pass, assume the team passed X problems during the contest, and submitted Y times for t…
D. Developing Game   Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now he wants to pick n workers from the staff who will be directly r…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 175    Accepted Submission(s): 74 Problem Description ZYB has a premutation P,but he only remeber the reverse log of each prefix of the premutat…
题目链接:http://codeforces.com/contest/620/problem/E E. New Year Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The New Year holidays are over, but Resha doesn't want to throw away the N…
Ch’s gift Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1354    Accepted Submission(s): 496 Problem Description Mr. Cui is working off-campus and he misses his girl friend very much. After a w…
E. Garlands 题目连接: http://www.codeforces.com/contest/707/problem/E Description Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with gar…
Codeforces Round #267 (Div. 2) C. George and Job题目链接请点击~ The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the follow…
链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which point…
Codeforces Round #603 (Div. 2) A. Sweet Problem A. Sweet Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have three piles of candies: red, green and blue candies: the first pile…
传送门 Description You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next mon…
题意: 构造一个序列,满足m个形如:[l,r,c] 的条件. [l,r,c]表示[l,r]中的元素按位与(&)的和为c. 解法: 线段树维护,sum[rt]表示要满足到现在为止的条件时该子树的按位与和至少为多少. 更新时,如果val的pos位为1,那么整个区间的按位与和pos位也应该为1,否则与出来就不对了.(这是本题解题的核心) 那么此时更新 sum[rt] |= val 即可.然后再check一遍看是否满足所有条件即可. 代码: #include <iostream> #inclu…
D. Kay and Snowflake     After the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses. Now he likes to watch snowflakes. Once upon a time, he found a huge snowflake that has a form of the tree (connect…
E. Anton and Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are n v…
B. Guess the Permutation 题目连接: http://www.codeforces.com/contest/618/problem/B Description Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i,…
E. Correcting Mistakes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/533/E Description Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guarant…
B. Prison Transfer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/427/B Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c…
A. Case of the Zeros and Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/556/problem/A Description Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros an…
B. Queue Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/91/B Description There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of th…
D. Happy Tree Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/problem/D Description Bogdan has a birthday today and mom gave him a tree consisting of n vertecies. For every edge of the tree i, some number xi was w…
D. Super M Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/D Description Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces’ superhero. Byteforces is a country that…
题目链接:CF - R296 - d2 - D 题目大意 一个特殊的图,一些数轴上的点,每个点有一个坐标 X,有一个权值 W,两点 (i, j) 之间有边当且仅当 |Xi - Xj| >= Wi + Wj. 求这个图的最大团. 图的点数 n <= 10^5. 题目分析 两点之间右边满足 Xj - Xi >= Wi + Wj (Xi < Xj)       ==>     Xj  - Wj >= Xi + Wi (Xi < Xj) 按照坐标 x 从小到大将点排序.用…
题意:n个线段[Li, Ri], m次询问, 每次询问由cnt个点组成,输出包含cnt个点中任意一个点的线段的总数. 由于是无修改的,所以我们首先应该往离线上想, 不过我是没想出来. 首先反着做,先求不包含这个cnt个点的线段的总数, 那么不包含这些点的线段必然在cnt个点之间(这里需要再加两个点一个是0, 一个是MAX), 我们可以把所有线段按Ri 分类, 然后按右端点遍历,对于当前的线段可以在Li 处+1, 然后对于每一次询问中两个点(x, y)之间线段的个数, 只需要查询 左端点大于等于x…
F. A Heap of Heaps time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final tes…
线段树的区间更新与区间求和...一颗这样的线段树用两次... 先扫描1~k...用线段树统计出每个操作执行的次数... 那么每个操作就变成了 op. l  , op.r , op.c= times* op.c 清空线段树..将初始的a1,a2~~an放入..用每个操作来更新值~~ Program: #include<iostream> #include<stdio.h> #include<string.h> #include<set> #include &l…
当时晚上打CF时候比较晚,加上是集训期间的室友都没有晚上刷题的习惯,感觉这场CF很不在状态.A题写复杂WA了一发后去厕所洗了个脸冷静了下,换个简单写法,可是用cin加了ios::sync_with_stdio(false)还是WA了,真无语.B题读半天题,读懂后轻松A了,看了下比赛时间就快结束了,把C题读了一遍后,感觉能做,最后还是选择了睡觉23333.................. A题大意:平平平 增平减 ,缺任一都可,判断是否为这样的数列 #include<stdio.h> #inc…