自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(399)
  • 资源 (1)
  • 收藏
  • 关注

原创 Salty Fish

海边躺着一排咸鱼,一些有梦想的咸鱼成功翻身(然而没有什么卵用),一些则是继续当咸鱼。一个善良的渔夫想要帮这些咸鱼翻身,但是渔夫比较懒,所以只会从某只咸鱼开始,往一个方向,一只只咸鱼翻过去,翻转若干只后就转身离去,深藏功与名。更准确地说,渔夫会选择一个区间[L,R],改变区间内所有咸鱼的状态,至少翻转一只咸鱼。渔夫离开后想知道如果他采取最优策略,最多有多少只咸鱼成功翻身,但是咸鱼大概有十万条,所以这个

2017-08-24 20:37:01 279

原创 H - Highways (Prim)

The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already constructed a numbe

2017-08-24 19:57:14 307

原创 N - 畅通工程再续 (Kruskal)

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛

2017-08-24 11:20:53 288

原创 E - QS Network (Prim)

Sunny Cup 2003 - Preliminary RoundApril 20th, 12:00 - 17:00Problem E: QS NetworkIn the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each other via ne

2017-08-24 10:52:15 318

原创 D - Constructing Roads (Kruskal)

There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if th

2017-08-24 10:13:08 292

原创 C - Building a Space Station (Kruskal)

You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task. The spac

2017-08-24 09:52:32 335

原创 B - Networking (Kruskal)

You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pairs of po

2017-08-24 08:33:22 524

原创 A - Number Sequence (KMP)

Given two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], …… , a[K

2017-08-23 21:45:46 1142

原创 C - Courses (二分图--匈牙利)

Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that sat

2017-08-23 21:24:02 381

原创 B - The Accomodation of Students (二分图染色判断+匈牙利算法)

There are a group of students. Some of them may know each other, while others don’t. For example, A and B know each other, B and C know each other. But this may not imply that A and C know each other.

2017-08-23 20:56:58 384

原创 二分图的判断--染色

怎样判断一个图是否为二分图? 很简单,用染色法,即从其中一个顶点开始,将跟它邻接的点染成与其不同的颜色,如果邻接的点有相同颜色的,则说明不是二分图,每次用bfs遍历即可。判断二分图方法: 用染色法,把图中的点染成黑色和白色。 首先取一个点染成白色,然后将其相邻的点染成黑色,如果发现有相邻且同色的点,那么就退出,可知这个图并非二分图(一次bfs,O(n))。 匹配:选择若干条边,然后是任意两条

2017-08-23 20:09:34 520

原创 Air Raid(匈牙利)

Air RaidTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5542 Accepted Submission(s): 3726Problem Description Consider a town where all the

2017-08-23 19:25:53 421

原创 Machine Schedule(二分图匹配--匈牙利算法)

Machine Schedule Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6733 Accepted Submission(s): 3375Problem Description As we all know, mach

2017-08-23 19:19:28 318

原创 Girls and Boys(二分图--匈牙利算法)

Girls and BoysTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 12197 Accepted Submission(s): 5743Problem Description the second year of th

2017-08-23 18:53:22 347

原创 二分图

1.定义: 二分图又称作二部图,是图论中的一种特殊模型。 设G=(V,E)是一个无向图,如果顶点V可分割为两个互不相交的子集(A,B),并且图中的每条边(i,j)所关联的两个顶点i和j分别属于这两个不同的顶点集(i in A,j in B),则称图G为一个二分图。(BD) 2.推荐文章 3.步骤: a.从任意一个未配对的点开始,从此点任意选择一条边,开始配对。如果此点还没有配对,则配

2017-08-23 17:02:04 314

原创 复杂表达式(Python笔记)

复杂表达式 使用for循环的迭代不仅可以迭代普通的list,还可以迭代dict。假设有如下的dict:d = { ‘Adam’: 95, ‘Lisa’: 85, ‘Bart’: 59 } 完全可以通过一个复杂的列表生成式把它变成一个 HTML 表格:tds = ['<tr><td>%s</td><td>%s</td></tr>' % (name, score) for name, score i

2017-08-22 20:54:05 633

原创 迭代(python笔记)

Python 的 for循环不仅可以用在list或tuple上,还可以作用在其他任何可迭代对象上。请用for循环迭代数列 1-100 并打印出7的倍数。for i in range(101): if(i%7==0): print i,索引迭代也不是真的按索引访问,而是由 enumerate() 函数自动把每个元素变成 (index, element) 这样的tuple,再迭代

2017-08-22 20:00:35 337

原创 切片(python笔记)

range()函数可以创建一个数列: range(1, 101) [1, 2, 3, …, 100] 请利用切片,取出: 1. 前10个数; 2. 3的倍数; 3. 不大于50的5的倍数。L = range(1, 101)print L[:10],#取前十个print L[2::3],print L[4:51:5],记住倒数第一个元

2017-08-22 19:28:53 546

原创 函数(python笔记)

请定义一个 greet() 函数,它包含一个默认参数,如果没有传入,打印 ‘Hello, world.’,如果传入,打印 ‘Hello, xxx.’def greet(n='world'): if n=='world': print'hello, world.', else: print 'hello,', n,'.',greet()greet('B

2017-08-22 16:34:35 389

原创 温度转换(python笔记)

#温度转换程序#TempConvert.pyval = input("Please input a number")if val[-1] in ['C', 'c']: f = 1.8 * float(val[0:-1]) + 32 print("temperature"%f)保留字: 定义变量时,不能与之相同~and | elif | impor

2017-08-22 16:01:36 3333

原创 My first program written in Python

1.print'Hello World!'2. 一元二次方程的定义是:ax² + bx + c = 0请编写一个函数,返回一元二次方程的两个解。import mathdef quadratic_equation(a, b, c): temp = b * b - 4 * a * c if(temp < 0): return elif (temp == 0):

2017-08-22 15:42:55 380

原创 A Secret(KMP)

A SecretTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others) Total Submission(s): 1766 Accepted Submission(s): 653Problem Description Today is the birthday of SF,s

2017-08-21 20:18:32 444

原创 Friend-Graph

Friend-GraphTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1250 Accepted Submission(s): 645Problem Description It is well known that smal

2017-08-21 19:39:58 259

原创 数据结构实验之排序六:希尔排序

数据结构实验之排序六:希尔排序 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description我们已经学习了各种排序方法,知道在不同的情况下要选择不同的排序算法,以期达到最好的排序效率;对于待排序数据来说,若数据基本有序且记录较少时, 直接插入排序的效率是非常好的,希尔排序就是针对一组基本有序的少量数据

2017-08-18 21:11:56 198

原创 数据结构实验之排序四:寻找大富翁(堆排序)

数据结构实验之排序四:寻找大富翁 Time Limit: 200MS Memory Limit: 512KB Submit Statistic Problem Description2015胡润全球财富榜调查显示,个人资产在1000万以上的高净值人群达到200万人,假设给出N个人的个人资产值,请你快速找出排前M位的大富翁。 Input首先输入两个正整数N( N ≤ 10^6)和M(M ≤ 1

2017-08-18 20:29:07 378

原创 Building Roads(Prim+Kruskal)

Building Roads Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11767 Accepted: 3351 DescriptionFarmer John had just acquired several new farms! He wants to connect the farms w

2017-08-17 20:28:26 419

原创 Network(Kruskal)

Network Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17237 Accepted: 6925 Special Judge DescriptionAndrew is working as system administrator and is planning to establi

2017-08-17 16:40:48 295

原创 Bad Cowtractors(Kruskal)

Bad Cowtractors Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16242 Accepted: 6631 DescriptionBessie has been hired to build a cheap internet network among Farmer John’s N (

2017-08-17 15:01:56 264

原创 Arctic Network(Prim)

Arctic Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 22153 Accepted: 6853 DescriptionThe Department of National Defence (DND) wishes to connect several northern outp

2017-08-17 11:27:58 372

原创 Truck History(Prim 最小生成树)

Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 29200 Accepted: 11417 DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are us

2017-08-17 09:31:30 365

原创 Frogger(Floyd变形)

Frogger Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 48084 Accepted: 15300 DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona F

2017-08-16 22:06:52 329

原创 Farm Irrigation(并查集)

Farm IrrigationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10408 Accepted Submission(s): 4568Problem Description Benny has a spacious f

2017-08-16 20:59:02 533

原创 山峰(单调栈)

山峰 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Description金石山脉有n个山峰,一字排开,从西向东依次编号为1, 2, 3, ……, n。编号为i的山峰高度为hi。每个山峰的高度两两不同 小木示从西向东依次爬过这n个山峰,到每一个山峰的山顶的时候,他都会往西边眺望,并且会记录下

2017-08-16 19:48:13 574

原创 魔戒(四维bfs)

魔戒 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Description蓝色空间号和万有引力号进入了四维水洼,发现了四维物体–魔戒。 这里我们把飞船和魔戒都抽象为四维空间中的一个点,分别标为 “S” 和 “E”。空间中可能存在障碍物,标为 “#”,其他为可以通过的位置。 现在他们想要尽快

2017-08-16 19:16:53 720

原创 Parity check(大数取模)

Parity check Time Limit: 2000MS Memory Limit: 524288KB Submit Statistic Problem DescriptionFascinated with the computer games, Gabriel even forgets to study. Now she needs to finish her homework, an

2017-08-16 15:51:25 565

原创 sum of power

sum of power Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem DescriptionCalculate mod (1000000000+7) for given n,m. InputInput contains two integers n,m(1≤n≤1000,0≤m≤10). Output

2017-08-16 15:39:27 272

原创 C~K的难题(费马小定理)

C~K的难题 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Description众所周知 C~K 喜欢数学,但是他最近被一个题给难住了,题目是这样的。 要求 (A/B)%10007,但由于 A 很大,我们只给出 n (n = A%10007)(我们给定的A必能被B整除,且 gcd(B,10

2017-08-16 14:54:16 594

原创 Lweb and String(set)

Lweb and StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1301 Accepted Submission(s): 659Problem Description Lweb has a string S.Oned

2017-08-16 10:06:52 304

原创 Danganronpa

题意:有n种礼物,每种礼物的个数为a[i],每个桌子代表一个人,每个桌子上放一个神秘礼物放一个普通礼物,相邻的桌子普通礼物种类不同,问最多有多少人拿到礼物? 思路: 每种礼物让他们自己又当神秘礼物又当普通礼物放一个桌子上面 (1)最大的大于剩下的总和,此时肯定是(sum-max)*2+1,不难想出 (2)最大的小于剩下的总和,这是不足的需要后面的来补,答案肯定是sum/2,贪心+优先对列也可

2017-08-16 09:42:09 589

原创 A water problem(大数取模)

A water problemTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3124 Accepted Submission(s): 1126Problem Description Two planets named Haha

2017-08-16 08:41:27 656

空空如也

空空如也

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

TA关注的人

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