自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 HDU-5923 Prediction

There is a graph G=⟨VG,EG⟩ with |VG|=n and |EG|=m, and a magic tree T=⟨VT,ET⟩) rooted at 1, which contains m vertices. Each vertex of the magic tree corresponds to an edge in the original graph G ...

2018-08-30 09:31:53 230

原创 codeforces-946DTimetable

D. Timetabletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan is a student at Berland State University (BSU). There are n days in Berland week,...

2018-03-10 20:23:03 591

原创 codeforces-342E-Xenia and Tree

E. Xenia and Treetime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia the programmer has a tree consisting of n nodes. We will consider the tree ...

2018-03-04 22:31:17 508

原创 codeforces919D-Substring

D. Substringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a graph with n nodes and m direc

2018-02-01 20:09:52 286

原创 codeforces-375DTree and Queries

D. Tree and Queriestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a rooted tree consisting of n v

2018-01-27 20:48:04 218

原创 codeforces-915C Permute Digits

C. Permute Digitstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integer numbers

2018-01-15 19:10:14 772

原创 UVA-10480 Sabotage

题目分析:网络流求最小割的模板题,难点在于求出最小割集。求出最小割集的方法是在求网络流之后跑一遍BFS对能够跑到的点进行标记(能跑到表示该点与起点处于同一割点集),然后遍历边,则最小割边即于起点被标记,终点没被标记的边,去重依次输出即可。#include#include#include#include#include#include#include#include#includ

2017-12-28 19:13:41 320

原创 codeforces 900C

C. Remove Extra Onetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of length

2017-12-17 21:52:48 576

原创 codeforces628DMagic Numbers

Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of the number on even positions and nowhere else.For example, the numbers 1727

2017-12-07 19:33:07 242

原创 HDU-4738Caocao's Bridges

Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good at water battles, so he came up with another idea. He built many island

2017-12-07 18:38:53 355

原创 HDU-3667 Transportation

There are N cities, and M directed roads connecting them. Now you want to transport K units of goods from city 1 to city N. There are many robbers on the road, so you must be very careful. The more go

2017-12-06 19:45:37 243

原创 codeforces-894C

C. Marco and GCD Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn a dream Marco met an elderly ma

2017-11-20 10:46:22 446

原创 HDU-3572Task Schedule

不分析了,这题主要是记一个错误,DEBUG了一个小时(f=dfs(e.to,min(a,e.cap-e.flow))>0))(f=dfs(e.to,min(a,e.cap-e.flow)))>0)#include#include#include#include#include#include#include#include#include

2017-11-13 20:43:13 222

原创 POJ-3694 NetWork

A network administrator manages a large network. The network consists of N computers and M links between pairs of computers. Any pair of computers are connected directly or indirectly by successive li

2017-11-07 21:36:00 262

原创 POJ-1236Network of Schools

A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving sc

2017-11-02 21:48:19 231

原创 UVA10054-The Necklace

题目大意:给你一些珠子,每个珠子都会有两个数值,珠子与珠子之间能相连当且仅当它们的连接处数值相等,                  问你能不能由这些珠子组成一条项链,即所有珠子都相连起来(包含头与尾)。题目分析:这是一道关于欧拉回路的题目,我们可以把珠子与珠子连接处的两个数值抽象成一个点,然后可以试试几个样例发现这是                     一条点与点之间只连一条

2017-10-21 09:46:22 275

原创 Gym - 101170I UVALIVE-7767 Iron and Coal

原题粘贴下来排版很难看,就不贴题目了把。题意大意:给你一张有向图,起点为1,其中每经过一个未曾到过的点都会派一个人驻守这个点,标记图中某些点为铁矿点,某些点为煤矿点,现在问你从起点出发,至少到一次煤矿点和铁矿点,最少派多少人。题意分析:很容易看出是一个最短路题,由于边权为1,问题可以直接用bfs解决,而解决这道问题的难点在于对分叉点的处理,因为在一条包含分叉点的路径中,

2017-10-10 20:37:54 410

原创 NWERC2015-Elementary Math

题意分析:把一对数字看成一个点A,然后把一对数字的和、差、积视作另外三个点,把点A与这三个点连接起来可构成                  一个二分图,然后跑匈牙利求最大匹配就好了。                 图论果然难在建图与模型搭建啊,题目做得还是少了,WA了几次是因为相乘时没加(LL),这个错误犯了好几次了,                 这次必须记下来!!   

2017-10-01 20:55:23 349

原创 POJ-1144NetWork

DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the same number. T

2017-09-10 21:30:45 238

原创 Codeforces851B

B. Arpa and an exam about geometrytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputArpa is taking a geometr

2017-09-05 11:26:55 344

原创 Codeforces848A-From Y to Y

A. From Y to Ytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFrom beginning till end, this message has bee

2017-09-02 20:44:16 339

原创 Codeforces-849B Tell Your World

B. Tell Your Worldtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputConnect the countless points with lines,

2017-09-02 20:31:13 306

原创 HDU-4300Clairewd’s message

题目大意:给定一个匹配串(长度为26)s,其中s[i]对应第i个小写字母,再给一段由密文和明文混杂的字符串(可能只有密文)                    其中密文必定已全部给出,明文则不一定,现在要求对于给出的字符串所能得到的最短的完整的密文+明文串,                    即密文和明文完全匹配。题目分析:首先注意的是字符串最大长度为1e5,直接暴力枚举

2017-08-09 20:55:00 304

原创 POJ-1733Parity game

题目大意:两个小伙伴A,B在耍,A给出一段长度为n的01串(未知,最大长度为1e9),B给出两个值l,r询问                   区间[l,r]内1的个数为奇数还是偶数(共询问m次),A给出应答,但A得应答不一定正确。问m次应                   答中A是否有在第k次(第一次出现)中给出错误应答,若有则输出数字k-1,没有则输出m。题目分析:是一

2017-08-09 20:26:12 334

原创 Codeforces-835C

题目大意:天空上有n颗星星,每颗星星都有其自己的坐标(x,y)和初始发光值s,对于所有星星都有共同的最大的发光值c。                    现在给出q段询问,分别给出时刻t,矩形的左下角坐标(x1,y1),右上角坐标(x2,y2),求在t时刻后该矩形内所能看到                     的发光值总和。                    发光值计算方法:

2017-08-01 09:14:48 320

原创 UVA-11019Matrix Matcher(AC自动机)

题目的大意是对于给定的文本串和模板串,要求出模板串在文本串中出现的次数,那么很显然可以先对模板串一行一行的进行构建Trie树,而后对于文本串也一行一行的进行匹配寻找,在寻找的过程中对相应的行列进行记录就可以了,其中要注意的是模板串中可能重复字符串,即不同行的字符串相同,因而要另设一数组进行相应的记录,妥妥的一道AC自动机题。值得一提的是本题可以用Hash的思想去做,并且时间复杂度可以降

2017-07-30 15:13:10 478

原创 CSU-1904-精灵的交际网

这是一道关于并查集的题目,和HDU-1829很相似,不过数据范围有了一点改变,HDU-1829在此:https://vjudge.net/problem/16380/origin理论上这一题和HDU-1829应该都有两种方法,一个是设置两个并查集,将冲突的两个精灵合并入两个不同的并查集中,在合并的过程中如果发现合并冲突则表明出现问题,直接记录位置输出即可,但我用这个做法一直TLE,加了

2017-06-18 17:40:49 511

原创 CSU-1945 最简单的题目

比赛的时候拿贪心的代码改来改去死活Y不下来,后来跟人讨论一下才得知是个背包问题,果然自己有关背包和DP方面的理解不深啊。具体的思路在于对当前问题的求解在于尽量使两台机器工作的时间相近,这样才能让最后结束的机器工作的时间最短。做法的话便是排序后进行枚举,标记数值小于等于时间总和的一半的时间点。#include#include#include#include#i

2017-05-29 09:02:43 485 1

原创 CSU-1560 图书管理员的表白方式

题目中的要求构成V字形其实隐含着要求两个最大上升子序列因此可以枚举下标为1-(N-1)的点,分别对两边求最大子序列,最后统计要拿走的书并做出判断是否可以构成V字形总的来说是一道基础DP的变式#include#includeusing namespace std;int dp1[105],dp2[105];int ax[105];int main(){ int T;

2017-04-18 23:00:10 533

原创 CSU-1830 FarAway

概述:忙得不行的主角要从城市1(限定)坐飞机到其他城市,为了多休息所以要尽量挑距离远的城市飞(终点是随意的),而且不满足睡觉时间还不飞(兄弟你很跳啊)       这一题其实可以是说一道模板题,只不过从最短路变成了最长路,但思路是差不多的。对于我来说还是蛮好的,第一次在最短路的题目中使用了vector、队列和pair。其中有几个要注意的点:1、路径全为单向,且除了城市1以为其他城市只有

2017-04-12 23:12:43 459

原创 放代码

import java.util.Scanner;public class a1 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n; n=sc.nextInt(); if(n1000)

2017-04-12 22:56:41 378

原创 POJ-2485

一道比较简单的最小生成树问题,直接上prim然后找出权值最大的子边就好了话说学习了几乎一天的最小生成树,现在终于有点理解两种算法的原理了。#include#include#includeusing namespace std;int T,N,ans=0;int ax[505][505];int dp[505],vis[505];const int maxn=65539;void

2017-03-14 22:36:31 334

原创 CSU-1511 残缺的棋盘 解题报告

这是第一道我自己独立解决的BFS题,也让我充分的掌握了BFS的代码模板,虽然是一道水题,但对我还是蛮有意义的。  本题的思路也是非常的简单,直接利用BFS通过广搜找到最小路径就OK了,中间注意标记已走过的路(和DFS不同,不用还原)还有那个被锁定的格子。代码如下:#include#include#include#includeusing namespace std;int r

2017-02-18 22:35:44 597

原创 POJ-3737 UmBasketella题解及体会

#include #include#include #include using namespacestd;#define eps 1e-8const double pi=acos(-1.0);double S;double cal(double x){    return(1.0/3.0)*x*sqrt(S*(S-(2*pi*x*x))

2017-02-08 22:26:11 402

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除