codeforces 359D 二分答案+RMQ
上学期刷过裸的RMQ模板题,不过那时候一直不理解>_<其实RMQ很简单:设f[i][j]表示从i开始的,长度为2^j的一段元素中的最小值or最大值那么f[i][j]=min/max{d[i][j-1], d[i+2^j-1][j-1]}RMQ的ST算法: void ST() ...
Codeforces Round 935 (Div. 3)(A,B,C,D,E,F)
比赛链接 阳间场,阴间题,最考阅读理解的一场。题目本身的难度不大。 A. Setting up Camp 题意: 组委会计划在奥运会结束后带领参赛者进行一次徒步旅行。目前,需要携带的帐篷数量正在计算中。据了解,每个帐篷最多可容纳 ...
解决codeforces访问慢的问题
转载至:http://blog.csdn.net/wmx16835/article/details/38639451 前阵子打Codeforces(以下简...
Codeforces Round 925 (Div. 3)
比赛地址 Dashboard - Codeforces Round 925 (Div. 3) - Codeforces A. Recovering a Small String 直接模拟 #include<bits/stdc++.h>#define IOS ios::sync_with_...
Codeforces 1340B Nastya and Scoreboard(dp,贪心)
题目链接OvO题目大意 给你\(n\)串数字,\(1\)代表该位置是亮的,\(0\)代表是灭的。你必须修改\(k\)个数字,使某些\(0\)变为\(1\)...
Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) B. Weakened Common Divis
题目链接让你找一个数,使得这个数,可以被每个二元组的两个数中的一个数整除。先将第一个二元组的两个数质因数分解一下,分解的质数加入set中,然后,对剩下的n-1个二元组进行遍历,每次遍历到的二元组对s中的质数进行判断是否能整除。如果某个质数可以被n-1个二元组整除(两个数中的一个)。好浅显的思路,,,...
Codeforces Round #371 (Div. 2) C. Sonya and Queries
题目链接分析:01trie树,很容易就看出来了,也没什么好说的。WA了一发是因为没有看见如果数字位数大于01序列的时候01序列也要补全0。我没有晚上爬起来打,白天发现过的人极多。/*****************************************************///#pra...
Codeforces Round #371 (Div. 2)E. Sonya and Problem Wihtout a Legend[DP 离散化 LIS相关]
E. Sonya and Problem Wihtout a Legendtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSonya was u...
Codeforces Round #371 (Div. 2) C. Sonya and Queries[Map|二进制]
C. Sonya and Queriestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday Sonya learned about lon...
【CodeForces】713 C. Sonya and Problem Wihtout a Legend
【题目】C. Sonya and Problem Wihtout a Legend【题意】给定n个数字,每次操作可以对一个数字±1,求最少操作次数使数列递增。n<=10^5。【算法】动态规划+前缀和优化【题解】★令b[i]=a[i]-i,则a[i]递增等价于b[i]不递减。这样做之后,显然数字...
Codeforces Round #371 (Div. 2) C. Sonya and Queries —— 二进制压缩
题目链接:http://codeforces.com/contest/714/problem/CC. Sonya and Queriestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputou...
Codeforces Round #371 (Div. 1)
A:题目大意:在一个multiset中要求支持3种操作:1.增加一个数2.删去一个数3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给出的01序列相等(比较时如果长度不等各自用0补齐)题解:1.我的做法是用Trie数来存储,先将所有数用0补齐成...
Educational Codeforces Round 16 B
DescriptionYou are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal.InputTh...
Educational Codeforces Round 16
A. King Moveswater。= =。 #include <cstdio> ,,,,,-,-,-}; ,-,,,-,,,-,}; #define judge(x,y) x >= 1 && x <= 8 && y >= 1 &...
Educational Codeforces Round 7 D. Optimal Number Permutation 构造题
D. Optimal Number Permutation题目连接:http://www.codeforces.com/contest/622/problem/DDescriptionYou have array a that contains all integers from 1 to n tw...
Educational Codeforces Round 37 E. Connected Components?(图论)
E. Connected Components?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirec...
Educational Codeforces Round 37 (Rated for Div. 2)C. Swap Adjacent Elements (思维,前缀和)
Educational Codeforces Round 37 (Rated for Div. 2)C. Swap Adjacent Elementstime limit per test1 secondmemory limit per test256 megabytesinputstandard ...
Educational Codeforces Round 43 (Rated for Div. 2) ABCDE
A. Minimum Binary Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputString can be called corr...
Educational Codeforces Round 37 G. List Of Integers (二分,容斥定律,数论)
G. List Of Integerstime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's denote as L(x, p) an in...
Educational Codeforces Round 37 A B C D E F
A. water the gardenCode#include <bits/stdc++.h>#define maxn 210using namespace std;typedef long long LL;int n, k;int x[maxn];void work() { sc...