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

 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
A. Joysticks time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
题目链接: http://codeforces.com/problemset/problem/650/C C. Table Compression time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and m…
E. Clockwork Bomb 题目连接: http://www.codeforces.com/contest/650/problem/E Description My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations…
D. Zip-line 题目连接: http://www.codeforces.com/contest/650/problem/D Description Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long as possible but he doesn't remember exactly the heights of all trees in t…
E. Table Compression 题目连接: http://www.codeforces.com/contest/651/problem/E Description Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now…
D. Image Preview 题目连接: http://www.codeforces.com/contest/651/problem/D Description Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over…
C. Watchmen 题目连接: http://www.codeforces.com/contest/651/problem/C Description Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watch…
B. Beautiful Paintings 题目连接: http://www.codeforces.com/contest/651/problem/B Description There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes happy every time he passes from a painting…
A. Joysticks 题目连接: http://www.codeforces.com/contest/651/problem/A Description Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2…
A. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. The…
DFS A - Joysticks 嫌麻烦直接DFS暴搜吧,有坑点是当前电量<=1就不能再掉电,直接结束. #include <bits/stdc++.h> typedef long long ll; const int N = 1e5 + 5; int ans = 0; void DFS(int a, int b, int step) { if (a <= 0 || b <= 0) { ans = std::max (ans, step); return ; } if (a…
C. Table Compression Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name d…
Watchmen 题意:有n (1 ≤ n ≤ 200 000) 个点,问有多少个点的开平方距离与横纵坐标的绝对值之差的和相等: 即 = |xi - xj| + |yi - yj|.(|xi|, |yi| ≤ 109) 思路:开始想的是容斥原理,即按x,y分别排序,先计算同x的点,然后在计算同y的点,这时由于相同的点之间的连边已经算过了,这样就不能再算.并且同一个y的点中可以每个点有多个点,算是不好编码的(反正我敲了很久..WA了) 反思:上面的容斥原理是从总体的思路来考虑的,这道题的难点也就是…
Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly,…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
D - Zip-line #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> using namespace std; ; const int inf = 0x3f3f3f3f; const LL INF = 0x3f3f3f3f3f3f3f3f; ; ][N], stk[N],…
C. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. The…
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
题意概述: 给出一个长度为N的序列和M组询问,问假设把某个位置的值改成另一个给出的值之后,序列的最长上升子序列的长度. N,M<=400000. 分析: 考虑某个位置的值改动后这个位置和最长上升子序列(lis)的关系: 1.这个位置包含在lis中(这种情况答案可能+1,可计算经过这个点的lis来等效决策). 2.这个位置不包含在lis中,那么需要看是否任意的lis都经过这个位置.如果是的话此决策的结果在原来长度基础上-1,否则就等于原来的长度. 有了大体思路,接下来想想维护. 任务1:对于任意位…
B. Beautiful Paintings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
传送门 首先先从小到大排序,如果没有重复的元素,直接一个一个往上填即可,每一个数就等于当前行和列的最大值 + 1 如果某一行或列上有重复的元素,就用并查集把他们连起来,很(不)显然,处于同一行或列的相同元素始终应该保持一样的,然后再一个一个往上填 #include <bits/stdc++.h> #define N 1000007 #define fi first #define se second using namespace std; pair <int, pair<int,…
E. Table Compression time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zipalgorithms and many others.…
Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name dis. Petya decided to…
题意:给你\(n\)个点,求这\(n\)个点中,曼哈顿距离和欧几里得距离相等的点对数. 题解: 不难发现,当两个点的曼哈顿距离等于欧几里得距离的时候它们的横坐标或者纵坐标至少有一个相同,可以在纸上画一画,当两点不满足上文所说的情况时,他们的曼哈顿距离一定大于直线距离,因为三角形的两边必定大于第三边,然后我们边输入边求,用桶分别存横和纵坐标,每次出现都将目前桶的值贡献给答案,但是两个相同的点应该只算一次贡献,我们要再开一个桶来减去重复的次数. 代码: int n; map<ll,ll> mpx,…
Codeforces Round #506 (Div. 3) 题目总链接:https://codeforces.com/contest/1029 A. Many Equal Substrings 题意: 给出长度为n的字符串,然后要求你添加一些字符,使得有k个这样的字符串. 题解: 直接暴力吧...一个指针从1开始,另一个从2开始,逐一比较看是否相同:如果不同,第一个指针继续回到1,第二个指针从3开始...就这么一直重复.最后如果第二个指针能够顺利到最后一位,那么记录当前的第一个指针,把他后面的…
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…