Codeforces 380E Sereja and Dividing】的更多相关文章

题面 洛谷传送门 题解 博客 有精度要求所以只用求几十次就差不多了 CODE #include <bits/stdc++.h> using namespace std; typedef long long LL; const int MAXN = 300005; struct node { int v, id; inline bool operator <(const node &o)const { return v < o.v || (v == o.v &&…
[CodeForces 1249A --- Yet Another Dividing into Teams] Description You are a coach of a group consisting of n students. The i-th student has programming skill ai. All students have distinct programming skills. You want to divide them into teams in su…
discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). Then Sereja marked each point with a small or large English letter. Sereja don't like letter "x", so he didn't use it to mark points. Sereja thi…
题目链接:A. Sereja and Swaps 题意:给定一个序列,能够交换k次,问交换完后的子序列最大值的最大值是多少 思路:暴力枚举每一个区间,然后每一个区间[l,r]之内的值先存在优先队列内,然后找区间外假设有更大的值就替换掉. 求出每一个区间的最大值,最后记录下全部区间的最大值 代码: By lab104_yifan, contest: Codeforces Round #243 (Div. 2), problem: (C) Sereja and Swaps, Accepted, #…
题意读了好久才读懂....不知道怎么翻译好~~请自便~~~ http://codeforces.com/problemset/problem/425/C 看懂之后纠结好久...不会做...仍然是看题解看代码才懂的... dp[i][j]表示A数组前i个数,第一个操作做j次的B数组的最小下标.代码里把第一维给压掉了. 复杂度,n*s/e*logn吧... #include <cstdio> #include <cstring> #include <iostream> #i…
题目链接:http://codeforces.com/problemset/problem/381/B 题目意思:给定一个m个数的序列,需要从中组合出符合楼梯定义 a1 < a2 < ... < ai - 1 < ai > ai + 1 > ... > a|a| - 1 > a|a|. 的最长序列. 思路不复杂,先把输入的序列按从小到大排序,然后依次挑出不相同的数(顺挑).接着倒序再挑出不相同的数(可以与顺挑时的数相同).有一个要注意的地方是,挑出的那些数的…
题目链接:http://codeforces.com/problemset/problem/315/A 题目意思:有n个soda bottles,随后给出这n个soda bottles的信息.已知第 i 个bottle来自品牌ai,你可以用这个品牌 ai 来开所有属于品牌bi 的bottles.注意,other特别用黑色粗体来强调,表明该行的除外,也就是说,假如i = 1(隐含的),ai = 1,bi = 1,这个bottle 1 是不能被打开的.需要找出无论用什么方式都不能打开的bottle的…
原题地址:http://codeforces.com/problemset/problem/380/A 让期末考试整的好久没有写题, 放假之后由于生病也没怎么做,新年的第一场CF也不是那么在状态,只过了div2的前两道题,第三题想到算法但是太困了没写对,刚刚把第三题A了很兴奋,赶快过来把解题报告写了.不得不说这道题还算有点水平 题目大意: 维护一个初始为空的序列,支持两种操作,共 m 个(1 <= m <= 10 ^ 5): 1 将一个数插入到数列的尾端(插入的数不大于10 ^ 5) 2 将数…
http://codeforces.com/contest/426/problem/C 题意:找出连续序列的和的最大值,可以允许交换k次任意位置的两个数. 思路:枚举区间,依次把区间内的比较小的数换成区间外的比较大的数. #include <cstdio> #include <iostream> #include <cstring> #include <queue> #include <algorithm> using namespace std…
Sereja has a sequence that consists of n positive integers, a1, a2, ..., an. First Sereja took a piece of squared paper and wrote all distinct non-empty non-decreasing subsequences of sequence a. Then for each sequence written on the squared paper, S…