C. Everyone is a Winner! On the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following algorithm: if k participants take part in this event, then the n rating is evenly di…
链接: https://codeforces.com/contest/1263/problem/C 题意: On the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following algorithm: if k participants take part in this event, t…
tag里有二分,非常的神奇,我用暴力做的,等下去看看二分的题解 但是那个数组的大小是我瞎开的,但是居然没有问题233 #include <cstdio> #include <cmath> #include <cstring> using namespace std; const int N = 1e7; int c[N]; int main() { int t; scanf("%d", &t); while (t--) { int n; sc…
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…
E. Editor 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 points to the current character. Please note that…
链接: 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…
D. Secret Passwords One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of n passwo…
链接: https://codeforces.com/contest/1263/problem/D 题意: One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piec…
链接: https://codeforces.com/contest/1263/problem/B 题意: A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (…
链接: https://codeforces.com/contest/1263/problem/A 题意: You have three piles of candies: red, green and blue candies: the first pile contains only red candies and there are r candies in it, the second pile contains only green candies and there are g ca…
F. Economic Difficulties 题目链接: https://codeforces.com/contest/1263/problem/F 题目大意: 两棵树,都有n个叶子节点,一棵树正着放,一棵树倒着放,叶子节点从左到右对应装置1,2,3,4...n,问最多能删掉多少条边,使得装置能与两棵树任意一个根节点1相连. 解题思路: mp[ i ][ j ]是装置 i 到 j 这段区间删除这段连续区间所能删除的最大边数,两个图分开看,算出每一个图中如果不连通这段区间对应的叶子节点所能删除…
E. Editor 题目链接: https://codeforces.com/contest/1263/problem/E 题目大意: 输入一个字符串S1含有‘(’ , ‘)’ , ‘R’ , ‘L’ 以及其他字符.根据这个字符串,得到相应的字符串S2.起始idx=1即S2的初始坐标,然后从左到右读取S1,当遇到'L',idx减小1(当无法左移的情况下idx不减小),当遇到'R',idx增加1,当读取到其他字符时,将idx这个位置上的字符更新为读取到的新的字符.然后输出每一步得到的字符串S2最大…
http://codeforces.com/contest/1263/problem/E 题意:求合法的括号序列 #include<bits/stdc++.h> using namespace std; typedef long long ll; #define lson root<<1,l,midd #define rson root<<1|1,midd+1,r #define pb push_back const int inf=0x3f3f3f3f; const…
传送门 感觉脑子还是转得太慢了QAQ,一些问题老是想得很慢... A. Sweet Problem 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/29 22:36:19 */ #include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <set> #include <ma…
F. Economic Difficulties An electrical grid in Berland palaces consists of 2 grids: main and reserve. Wires in palaces are made of expensive material, so selling some of them would be a good idea! Each grid (main and reserve) has a head node (its num…
B. PIN Codes A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2≤n≤10) bank cards, the PIN code of the i…
A. Sweet Problem the first pile contains only red candies and there are r candies in it, the second pile contains only green candies and there are g candies in it, the third pile contains only blue candies and there are b candies in it. Each day Tany…
A. Sweet Problem (找规律) 题目链接 大致思路: 有一点瞎猜的,首先排一个序, \(a_1>a_2>a_3\) ,发现如果 \(a_1>=a_2+a_3\) ,那么答案肯定是 \(a_2+a_3\) ,然后发现发现规律当 \(a_2==a_3\) 的时候,还可以贡献 \((a_1+a_2+a_3)/2\) 的答案,所以只要 \(a_1\) 和 \(a_2\) 减掉一个值就可以了. B. PIN Codes (暴力) 题目链接 大致思路: 可以知道,存在一个数字不同的pi…
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int _; cin>>_; while(_--){ ];; ;i<=;i++){ cin>>a[i];add+=a[i]; } sort(a+,a++); ; ]-a[]; ]>=cha){ a[]-=cha; ; ans=a[]+a[]/; cout<<ans<<'\n…
#include <cstdio> #include <algorithm> using namespace std; int main() { int t; scanf("%d", &t); while (t--) { int r, g, b; scanf("%d %d %d", &r, &g, &b); int sum = r + g + b; int maxn = max(r, g); maxn = ma…
C. GukiZ hates Boxes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/551/problem/C Description Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. In total there…
D. Vanya and Computer Game Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/492/problem/D Description Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character pe…
链接:http://codeforces.com/contest/484/problem/E 题意: 给你n个数的,每个数代表高度: 再给出m个询问,每次询问[l,r]区间内连续w个数的最大的最小值: 思路: 因为查询的到的值一定是输入的其中一个,那么我们可以二分答案,判断二分得到的答案是否符合,那么在这里我们就只需要找到某个数x,查询区间[l,r]有多少个连续的数大于x,这个操作只需要将高度从小到达排序,倒着插入主席树中,值设为1,那么只要维护有多少个连续的1(线段树区间合并的方法),就代表有…
C. Anton and Fairy Tale 题目连接: http://codeforces.com/contest/785/problem/C Description Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there liv…
D. Searching Rectangles 题目连接: http://codeforces.com/contest/714/problem/D Description Filya just learned new geometry object - rectangle. He is given a field consisting of n × n unit cells. Rows are numbered from bottom to top with integer from 1 to…
C. Mike and Chocolate Thieves 题目连接: http://www.codeforces.com/contest/689/problem/C Description Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! Aside from loving sweet things, thieves from t…
B. Preparing for the Contest 题目连接: http://codeforces.com/contest/377/problem/B Description Soon there will be held the world's largest programming contest, but the testing system still has m bugs. The contest organizer, a well-known university, has n…
A. Pupils Redistribution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In hig…
D. Nature Reserve 题目链接:https://codeforces.com/contest/1059/problem/D 题意: 在二维坐标平面上给出n个数的点,现在要求一个圆,能够容纳所有的点,并且与x轴相切的最小半径为多少. 题解: 容易知道圆的纵坐标的绝对值等于其半径,并且半径越大,容纳圆的可能性越大,那么就考虑二分其半径,这样y0值也确定了. 但x值不是很好求.这里我们找到y=y0的那一条线,然后根据半径以及y0,yi值,可以求出当x0在哪一段时,能够包含(xi,yi)这…