
CodeForces
Rain722
这个作者很懒,什么都没留下…
展开
-
codeforce44B. Valera and Fruits
题目大意:有n颗果树,每颗果树的有效采摘日期只有两天,并且农夫的每天采摘上限为v,求最大的采摘量#include#include#includeusing namespace std;struct node{ int start; int number; int endday;} fru[10000];bool cmp(node a, node b){原创 2016-08-03 17:50:24 · 602 阅读 · 0 评论 -
Codeforces 449B Jzzhu and Cities(最短路)
题目传送门:http://codeforces.com/contest/450/problem/D题意:一个城市,有m条道路,还有k条铁路(铁路都与点1相连),问在不改变点1到各个点的最短路的前提下最多可以删除多少条铁路思路:将道路和铁路一起建在同一个图中,跑一遍最短路并记录每个点的入度,接下来有两种情况可以判断可以删除这条铁路。1,如果最短路比铁路到点1的距离短,那毫无疑原创 2017-03-05 20:30:08 · 604 阅读 · 0 评论 -
Codeforce#394E. Dasha and Puzzle(dfs)
题目大意:判断n个点能否被n-1条边相连,且每条边都平行于坐标轴。分析:因为最多也就30个点,所以把边延伸地很长即可:#includeusing namespace std;#define pb push_back#define PII pairconst int maxn = 50;vector v[maxn];int nx[] = {0, 1, 0, -1}原创 2017-02-01 15:21:19 · 412 阅读 · 0 评论 -
Codeforces#245D. Working out(dp)
题意及qduoj链接:https://qduoj.com/problem/118/思路:把原先的两对起点和终点转化为四个七点,那么就有左上角、右下角、左下角、右上角这样四个七点。用4个dp[i][j],表示起点到(i,j)这个点的最大值!然后枚举相遇点,求出最大值!仔细分析一下之后,可以知道相遇点不可能在第一列&&第一行&&最后一列&&最后一行,如果枚举这些点,就会出错原创 2017-01-12 15:31:31 · 585 阅读 · 0 评论 -
Codeforces Round #382D. Taxes(哥德巴赫猜想)
D. Taxestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr. Funt now lives in a country with a very specif原创 2016-11-28 16:52:27 · 821 阅读 · 0 评论 -
codeforce#367C. Hard problem
C. Hard problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy is fond of solving different tasks.原创 2016-08-14 16:41:10 · 523 阅读 · 0 评论 -
Codeforces#418C An impassioned circulation of affection
C. An impassioned circulation of affectiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNadeko's birthda原创 2017-06-08 12:27:10 · 463 阅读 · 0 评论 -
codeforces 814D An overnight dance in discotheque(贪心)
D. An overnight dance in discothequetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe crowdedness of the原创 2017-07-06 10:19:49 · 536 阅读 · 0 评论 -
Codeforces 831D Office Keys(思维or二分)
D. Office Keystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n people and k keys on a straigh原创 2017-07-17 20:51:44 · 772 阅读 · 0 评论 -
Codeforces821D Okabe and City(思维建图+最短路运用)
题目大意:现在给你N*M的一个矩阵,现在上边一共有K个永恒亮着的点,主人公从左上角出发,走到的点必须有亮光才行。但是现在不保证有亮光的点能够使得主人公到达右下角,所以他可以花费1单位金币去使得一行或者一列暂时性的亮着,如果他想再次使用魔法,那么之前暂时亮着的部分就必须灭掉了。问他最少花费多少金币,能够从左上角走到右下角。如果不能走到,输出-1.原创 2017-07-18 20:19:39 · 567 阅读 · 0 评论 -
Codeforces835C-Star sky(二维前缀和+思维)
Star skytime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputThe Cartesian coordinate system is set in the原创 2017-08-02 10:46:16 · 1189 阅读 · 0 评论 -
Codeforces557D Vitaly and Cycle 【染色判二分图 + 组合数学】
题目链接:Codeforces 557D Vitaly and CycleD. Vitaly and Cycletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outpu原创 2017-08-02 19:54:42 · 392 阅读 · 0 评论 -
codeforce C. Ray Tracing(扩展欧几里得|模拟)
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)C. Ray Tracingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputs原创 2016-10-11 21:26:17 · 726 阅读 · 0 评论 -
Codeforce#424E. Cards Sorting(脑洞+树状数组)
E. Cards Sortingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasily has a deck of cards consisting of n原创 2017-07-18 14:51:17 · 640 阅读 · 0 评论 -
Codeforces#383D. Arpa's weak amphitheater and Mehrdad's valuable Hoses(并查集+分组背包)
D. Arpa's weak amphitheater and Mehrdad's valuable Hosestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJus原创 2016-12-08 16:37:45 · 584 阅读 · 0 评论 -
codeforce376C. Socks(并查集+贪心)
题意:有n只袜子,要穿m天,袜子一共有k种颜色。给出每天要穿的左脚和右脚的袜子编号,但是袜子的颜色必须要一样,所以你就需要事先对袜子进行染色,是每天穿的袜子颜色都一样。分析:比赛的时候根本就没想到并查集,只是觉得肯定有一种贪心的策略。结束后发现竟然可以用并查集套上贪心,就思考了一波。首先各个袜子的父亲都是自己,每只袜子都隶属于一个集合(即自身)且集合内袜子个数为1,当遇到一天里颜色不一样的袜子原创 2016-10-17 20:45:12 · 1600 阅读 · 0 评论 -
Educational Codeforces Round 25E. Minimal Labels(拓扑排序+思维)
E. Minimal Labelstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a directed acyclic graph wit原创 2017-07-17 14:33:09 · 497 阅读 · 0 评论 -
Codeforce336D.Dima and Trap Graph(二分右端点+dfs验证)
题目传送门:http://codeforces.com/problemset/problem/366/D题意:有n个点m条无向边。初始你需要选择一个整数x,走第i条边的限制为Li 分析:因为答案肯定是这些边中最优左端点到某个右端点的,所以就成了在已知左端点的情况下,维护最大的右端点。二分右端点,dfs验证是否可行即可。#include#define PI acos(-1.0)#原创 2017-03-09 12:56:55 · 407 阅读 · 0 评论 -
codeforce#362B. Barnicle(java高精度类)
codeofrce:http://codeforces.com/contest/697/problem/Bqduoj:https://qduoj.com/problem/120/将科学计数法表示的数字转化为一般数字Java的高精度类:import java.util.Scanner;public class Main { static Scanner sc = new Sc原创 2017-01-01 15:59:06 · 640 阅读 · 0 评论 -
GoodBye2016C. New Year and Rating
C. New Year and Ratingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEvery Codeforces user has rating, de原创 2016-12-31 15:47:46 · 712 阅读 · 0 评论 -
Codeforces Round #371 (Div. 2)D. Searching Rectangles交互题
题目大意:Filya在边长为n的正方形里面, 画了两个矩形。这两个矩形的边与正方形的边平行,且两个长方形没有不能相交(边可以重合)。但是Filya忘记他把两个矩形画在正方形的哪边了,所以他问Sonya在以(x1, y1)为左下顶点和以(x2, y2)为右上顶点的矩形里面,完整包含了几个他之前画的矩形, 问的次数不能超过200次。让你来模拟这个过程。你的输入首先是n(正方形的边长),然后由计算机来问你原创 2016-09-20 14:48:22 · 566 阅读 · 0 评论 -
codeforce#378C. Epidemic in Monstropolis(模拟+分块+树状数组)
C. Epidemic in Monstropolistime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere was an epidemic in Monstro原创 2016-11-02 21:40:21 · 719 阅读 · 0 评论 -
codeforceB. Mishka and trip
B. Mishka and triptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Mishka is a great traveller and sh原创 2016-10-14 10:39:19 · 386 阅读 · 0 评论 -
codeforce#377B. Cormen — The Best Friend Of a Man
B. Cormen — The Best Friend Of a Mantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently a dog was boug原创 2016-10-18 12:16:56 · 710 阅读 · 0 评论 -
codeforce#377C. Sanatorium
C. Sanatoriumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy spent his vacation in a sanatorium, ca原创 2016-10-18 12:28:39 · 393 阅读 · 0 评论 -
codeforce#375D. Lakes in Berland
The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or water. The map is surrounded by the ocean.Lakes are the maximal regions of原创 2016-10-04 22:08:08 · 508 阅读 · 0 评论 -
Codeforces Round #377(Div. 2)D.Exams(二分+思维)
D. Examstime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputVasiliy has an exam period which will continue原创 2016-10-19 17:10:43 · 597 阅读 · 0 评论 -
codeforce#378D. Kostya the Sculptor
D. Kostya the Sculptortime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKostya is a genial sculptor, he has原创 2016-11-01 12:14:17 · 471 阅读 · 0 评论 -
Codeforce#379C. Anton and Making Potions(二分or贪心)
Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare npotions.Anton has a special kettle, that can prepare one p原创 2016-11-16 15:09:40 · 713 阅读 · 0 评论 -
Codeforces Round #379 (Div. 2) D. Anton and Chess(模拟)
D. Anton and Chesstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to play chess. Also, he like原创 2016-11-17 15:30:13 · 982 阅读 · 0 评论 -
Codeforces Round #380D. Sea Battle(贪心)
D. Sea Battletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGalya is playing one-dimensional Sea Battle on原创 2016-11-20 21:16:59 · 453 阅读 · 0 评论 -
Codeforces Round #381C. Alyona and mex
C. Alyona and mextime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlyona's mother wants to present an array原创 2016-11-24 03:03:28 · 634 阅读 · 0 评论 -
Codeforces Round#383C. Arpa's loud Owf and Mehrdad's evil plan
C. Arpa's loud Owf and Mehrdad's evil plantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you have notic原创 2016-12-07 17:05:30 · 685 阅读 · 0 评论 -
Codeforces Round #382C. Tennis Championship(递推+斐波那契数列)
C. Tennis Championshiptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFamous Brazil city Rio de Janeiro ho原创 2016-11-28 16:57:31 · 506 阅读 · 0 评论 -
Codeforce#385B.Hongcow Solves A Puzzle
B. Hongcow Solves A Puzzletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHongcow likes solving puzzles.原创 2016-12-18 12:17:53 · 434 阅读 · 0 评论 -
Codeforces Round #388 (Div. 2)D. Leaving Auction
传送门:点击打开链接题目大意:有n每一次出价都是一个整数对(a[i],b[i])(a[i]有q每一个询问包含一个整数k以及k个人的编号l[j],保证k的总和不会超过2e5问如果这些人不出现的话,谁会获得这件商品?对于每一个询问,输出两个整数,胜出者的编号以及胜出者出的价格,如果没有人胜出,输出两个0分析:数据结构的题。对于每个人出的价格都用vector加原创 2016-12-20 15:53:32 · 721 阅读 · 0 评论 -
Codeforce#354C. Vasya and String(前缀和二分or尺取)
C. Vasya and Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputHigh school student Vasya got a string o原创 2017-01-12 14:27:52 · 615 阅读 · 1 评论