B. War of the Corporations 题目连接: http://www.codeforces.com/contest/625/problem/B Description A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the…
传送门 Description A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000. This new devic…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just…
贪心 A - Guest From the Past 先买塑料和先买玻璃两者取最大值 #include <bits/stdc++.h> typedef long long ll; int main(void) { ll n, a, b, c; std::cin >> n >> a >> b >> c; ll ans = 0; if (n >= a) { ll cnt1 = n / a; ll res = n % a; if (res >…
B. War of the Corporations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce comp…
D. Finals in arithmetic 题目连接: http://www.codeforces.com/contest/625/problem/D Description Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all th…
C. K-special Tables 题目连接: http://www.codeforces.com/contest/625/problem/C Description People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitiv…
A. Guest From the Past 题目连接: http://www.codeforces.com/contest/625/problem/A Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found hi…
E. Frog Fights 题目连接: http://www.codeforces.com/contest/625/problem/E Description stap Bender recently visited frog farm and was inspired to create his own frog game. Number of frogs are places on a cyclic gameboard, divided into m cells. Cells are nu…
传送门 Description Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much…
传送门 Description People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitive programmers, while others collect funny math objects. Alis is among…
传送门 Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated. Koly…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably k…
C. K-special Tables time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language,…
A. Guest From the Past time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink.…
题目链接:http://codeforces.com/problemset/problem/719/C C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a…
https://codeforces.com/contest/1100/problem/F 题意 一个有n个数组c[],q次询问,每次询问一个区间的子集最大异或和 题解 单问区间子集最大异或和,线性基能处理,但是这次多次询问,假如每次重新建立基向量会超时 考虑区间的优先级,假如我只插入不删除的话,区间的优先级和左端点没有关系 贪心一下,只保留后面插入的基,这样就可以离线解决询问,然后查询的时候需要判基的位置是不是在左端点后面 代码 #include<bits/stdc++.h> #define…
B. Mahmoud and a Triangle 题目连接: http://codeforces.com/contest/766/problem/B Description Mahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't…
E. Trains and Statistic 题目连接: http://www.codeforces.com/contest/675/problem/E Description Vasya commutes by train every day. There are n train stations in the city, and at the i-th station it's possible to buy only tickets to stations from i + 1 to a…
A. Fox and Box Accumulation 题目连接: http://codeforces.com/contest/388/problem/A Description Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top…
题目链接:http://codeforces.com/contest/613/problem/D 题意概述: 给出一棵树,每次询问一些点,计算最少删除几个点可以让询问的点两两不连通,无解输出-1.保证询问的点总数不大于300000. 分析: 先考虑遍历的做法,统计每个点代表的子树中联通询问点的数量. 这个点不是询问点:如果有至少两个不同的子树中有询问点那么当前点一定被删除,因为这个时候不删除之后这两个点就是联通的:同时除了在更深的地方遇见第一种情况之外没有必要删除那些点:没有点不用管,只有一个点…
A. Points and Segments (easy) Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/430/problem/A Description Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on…
题目链接:http://codeforces.com/problemset/problem/448/C C. Painting Fence time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Bizon the Champion isn't just attentive, he also is very hardworking. B…
http://codeforces.com/contest/733/problem/D 给定n个长方体,然后每个长方体都能选择任何一个面,去和其他长方体接在一起,也可以自己一个,要求使得新的长方体的最短的那条边最大. 看样例2就知道,因为10.8.7和10.8.2组合后,min =  8,是最大的. 那么怎么做呢? 可以看到,一个长方体,能产生6种不同的摆放方式,然后排序后,排序的时候把a相同的尽可能排在一起,把b相同的尽可能地排在一起.因为这样就能分组了. 把数组分成若干组,相同的组里,a和b…
题目链接:http://codeforces.com/contest/731/problem/C 题解: 1.看题目时,大概知道,不同的袜子会因为要在同一天穿而差生了关联(或者叫相互制约), 其中一条袜子可以穿多次或者不穿.那么自然就想到用并查集(DSU), 把有关联的袜子放在一个集合(经过处理后,这个集合中所有的袜子的颜色一样). 2.集合问题搞定了,那么就轮到选颜色的为题了.怎么选颜色,使得每个集合的袜子颜色一样,且需要改变颜色的袜子尽可能少呢?方法是:对于每一个集合,选择袜子条数最多的那种…
题目链接:https://codeforces.com/contest/1265/problem/C 题意 从大到小给出 $n$ 只队伍的过题数,要颁发 $g$ 枚金牌,$s$ 枚银牌,$b$ 枚铜牌,要求: $g < s, g < b$ $g + s + d \le \lfloor \frac{n}{2} \rfloor$ 金牌队伍的过题数大于银牌,银牌队伍的过题数大于铜牌 输出颁发奖牌数最多的一种方案. 题解 根据第三个要求,奖牌一定是按过题数的大小颁发的. 金牌只颁发给过题最多数的队伍,…
The link to problem:Problem - D - Codeforces   D. Range and Partition  time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Given an array a of n integers, find a range of values [x,y] (x≤y…
---恢复内容开始--- 题目地址 简要题意: n个小伙子一起去买自行车,他们有每个人都带了一些钱,并且有公有的一笔梦想启动资金,可以分配给任何小伙子任何数值,当然分配权在我们的手中.现在给出m辆自行车的价格,需要你求出最多可以让多少个小伙子有属于自己的自行车(即自行车不可以两个人共有,只能一个人有),和在满足之前这个条件的情况下,通过最省私人钱的分配,最少需消耗多少私人的资金. 思路分析: 首先考虑,如何分配才是使其中x个小伙子能有自己车的最好分配方法.不难想到,将n个小伙子按个人资金从大到小…
C. Polycarp at the Radio time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a…
A. Buy a Shovel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is so…