CodeForces 362E Petya and Pipes】的更多相关文章

Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 362E64-bit integer IO format: %I64d      Java class name: (Any)   A little boy Petya dreams of growing up and becoming the Head Berland…
题意: 给一个网络中某些边增加容量,增加的总和最大为K,使得最大流最大. 费用流:在某条边增加单位流量的费用. 那么就可以2个点之间建2条边,第一条给定边(u,v,x,0)这条边费用为0 同时另一条边(u,v,K,1)费用为1,那么就可以通过限制在增广时相应的费用即可找出最大流 个人觉得这样做的原因是每次增光都是最优的.所以通过限制最终费用不超过K可以得到最优解 #include <map> #include <set> #include <list> #include…
题目链接:http://codeforces.com/problemset/problem/362/B 题目意思:给出整数n和m,表示有n级楼梯和m级dirty的楼梯,接下来m个数表示对应是哪一个数字的楼梯是dirty的楼梯,不一定是按小到大给定的,需要判断的是,在只可以走一级.二级或三级的情况,是否可以把所有的非dirty楼梯走完.当然,如果dirty的楼梯中包含第一级(初始位置)或者最后一级(最终位置),那么默认是不能走完非dirty楼梯的. 由于给定的dirty楼梯的数字是任意无序的,所以…
C. Petya and Catacombstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is…
B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he think…
B. Petya and Square time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya loves playing with squares. Mum bought him a square 2n × 2n in size. Petya marked a cell inside the square…
链接:https://codeforces.com/contest/1282/problem/C 题意:  有一个人参加考试,考试只有两种题,一种是简单题,每道题耗时固定为a:另一种是困难题,每道题耗时固定为b,保证b>a.解出一道题得分都是1.考试的规则并不只是写多少题得多少分,鼓励提前交卷.假如你没有提前交卷,那么有一部分的题目会列为“必做题”,当“必做题”的题目没有全部被完成的话,这门课就算0分:否则得到与题数相同的分数,包括“必做”和“非必做”的. 题意: 题意很明显需要按题目的“必做时…
题意:一个小男孩要上楼梯,他一次可以走1个台阶或2个台阶或3个台阶,但是有一些台阶是脏的,他不想走在脏台阶上.一共有n个台阶和m个脏台阶,他最开始在第1个台阶上,要走到第n个台阶.问小男孩能不能不踩到脏台阶的前提下走到n个台阶. 思路:对于给定的m个脏序列,先排序后,没有连续的三个数就行. #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<…
找每个数的约数(暴力就够了...1~x^0.5)....看这约数的倍数最后是哪个数...若距离大于了y..统计++...然后将这个约数的最后倍数赋值为当前位置...好叼的想法题.... Program: #include<iostream> #include<stack> #include<queue> #include<stdio.h> #include<algorithm> #include<string.h> #include&…
题意: 让你选一些边,选边的前提是端点都被选了,求所有的边集中,边权和-点权和最大的一个. 题解: 对于每个边建一个点,然后就是裸的最大权闭合子图, 结果比赛的时候我的板子太丑,一直T,(不会当前弧优化...) 当时补题用的是蔡队的Dinic当前弧优化板子 今天重写了一遍 #include <bits/stdc++.h> #define endl '\n' #define ll long long #define all(x) x.begin(),x.end() #define IO ios:…