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

D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single soluti…
D1. Magic Powder - 1 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraint…
任意门:http://codeforces.com/contest/1118/problem/D1 D1. Coffee and Coursework (Easy version) time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions…
传送门:http://codeforces.com/contest/1092/problem/D1 D1. Great Vova Wall (Version 1) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova's family is building the Great Vova Wall (named by Vo…
链接:https://codeforces.com/contest/1130/problem/D1 题意: 给n个车站练成圈,给m个糖果,在车站上,要被运往某个位置,每到一个车站只能装一个糖果. 求从每个位置开车的最小的时间. 思路: vector记录每个位置运送完拥有糖果的时间消耗,为糖果数-1 * n 加上消耗最少时间的糖果. 对每个起点进行运算,取所有点中的最大值. 代码: #include <bits/stdc++.h> using namespace std; typedef lon…
A. Holidays time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings …
A. Holidays 题意:一个星球 五天工作,两天休息.给你一个1e6的数字n,问你最少和最多休息几天.思路:我居然写成模拟题QAQ. #include<bits/stdc++.h> using namespace std; //#define int long long signed main(){ int n; cin>>n; ==){ ;x*=; cout<<x<<" "<<x; ; } ; ; ; int temp…
五一期间和然然打的团队赛..那时候用然然的号打一场掉一场...七出四..D1是个数据规模较小的题 写了一个暴力过了 面对数据如此大的D2无可奈何 现在回来看 一下子就知道解法了 二分就可以 二分能做多少个 每次对mid求一下不够的差值 比较差值与m的大小进行l与r的变换 由于自己一向对二分比较迷茫 自己琢磨出来一套神奇的办法面对边界数据 当小于和大于的时候 抛弃mid值 当等于的时候 直接break 然后打一发while试试能否向更好的情况偏移 当然在这个题目中 如果是直接break的时候就不用…
题目链接: http://codeforces.com/contest/670/problem/E 题解: 用STL的list和stack模拟的,没想到跑的还挺快. 代码: #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<list> #include<stack> using namespace std; + ; const in…
题目链接: http://codeforces.com/contest/670/problem/D2 题解: 二分答案. #include<iostream> #include<cstdio> #include<cstring> #include<map> using namespace std; + ; const int INF = 2e9; typedef __int64 LL; int n, k; int x[maxn], y[maxn]; bool…
题目链接:http://codeforces.com/contest/670/problem/E 给你n长度的括号字符,m个操作,光标初始位置是p,'D'操作表示删除当前光标所在的字符对应的括号字符以内的所有字符(比如'(()())'),'R'操作表示右移光标,'L'操作表示左移光标.删除操作后光标向右移,要是再向右移没有字符的话,那就停在最后的字符上了.问你最后的括号字符是怎么样的. 这题用链表写简单多了,直接模拟操作就行了,我用stl里的list. #include <bits/stdc++…
codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days…
E. Correct Bracket Sequence Editor 题目连接: http://www.codeforces.com/contest/670/problem/E Description Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). Note that a bracket sequence…
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For conveni…
B. Game of Robots 题目连接: http://www.codeforces.com/contest/670/problem/B Description In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier - an integer from 1 to 109. At some moment, robots dec…
A. Holidays 题目连接: http://www.codeforces.com/contest/670/problem/A Description On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings - 5 work days and then 2 days off. Your tas…
D1. RGB Substring (easy version) time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string s consistin…
一.题目 D1. Submarine in the Rybinsk Sea (easy edition) 二.分析 简单版本的话,因为给定的a的长度都是定的,那么我们就无需去考虑其他的,只用计算ai的值在每个位置的贡献即可. 因为长度是定的,如果ai在前,那么对所有的a的贡献就是在偶数位的贡献值然后乘以n即可. 如果ai在后,那么对所有ai的贡献就是在奇数位的贡献值然后乘以n. 将两种情况合并,其实就是求ai在每个位置下的贡献,然后乘以n. 时间复杂度是$O(n)$ 三.AC代码 1 #incl…
给出一个合法的括号串 有LRD三种操作 LR分别是左右移动当前位置 且合法 D为删除这个括号和里面的所有 当删除完成后 位置向右移动 如果不能移动 就向左 比赛都是很久远的事情了 写这道题也是一时兴起 先写了一发暴力 先拿a记录下来与这个括号相匹配的括号位置 拿vis记录括号是否被删除 每次碰到false的括号就整体跳过 然后一气跑到了test78才停下来 想了想暴力肯定不行 就加了l数组和r数组 来记录当前位置的左右仍存在的括号在哪 每次进行移动和删除的时候都利用这个进行移动 顺便更改 有一种…
F. Restore a Number   Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all languages of the world with integers from 1 to 109. I…
C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scient…
B. Game of Robots time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an intege…
A. Holidays time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings …
E. Correct Bracket Sequence Editor   Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). Note that a bracket sequence is correct if it is possible to get a correct mathematical expre…
因为当天的下午才看到所以没来得及请假所以这一场没有打...于是信息课就打了这场的模拟赛. A题: *题目描述: 火星上的一年有n天,问每年最少和最多有多少休息日(周六周天). *题解: 模7分类讨论一下. *代码: #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #ifdef WIN32 #define LL "%I64d" #else…
今天对着算法进阶指南,学了一下离散化.大概对桶排这样的算法优化比较好吧. 离散化:就是把无穷大的集合中若干个元素映射为有限集合以便于统计的方法.例如在很多时候,问题范围定义为整数集合Z,但涉及的元素只有m个.(桶排优化) 此时,我们就可以把这些整数与(1-m)建立起映射关系,再去掉重复的元素. 先排序,再删去相同的元素(也可以用unique函数) void discrete() { int m=0; sort(a+,a+n+); ;i<=n;i++)||a[i]!=a[i-]) b[++m]=a…
思路:枚举换的位置i,j 然后我们要先判断改序列能否完全匹配 如果可以 那我们就需要把差值最大的位置换过来 然后直接判断就行…
思路:枚举换的位置i,j 然后我们要先判断改序列能否完全匹配 如果可以 那我们就需要把差值最大的位置换过来 然后直接判断就行…