摘要:HDU 4442Physical Examination2012年金华赛区现场赛A题。水题,排序后解决。对于两个 a1,b1 和a2,b2;先1后2:a1+a2+a1*b2先2后1: a1+a2+b1*a2;1排在2前面的条件就是: a1*b2<b1*a2.所以按照这个条件排序,然后出结果就可以了。代码实现主要是要处理,会超出int的,最好用long long,或者乘之前强制转换下。代码:HDU 4442#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h&
阅读全文
摘要:NightmareTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4504Accepted Submission(s): 2272Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get
阅读全文
摘要:Online JudgeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3389Accepted Submission(s): 1276Problem DescriptionIgnatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from co
阅读全文
摘要:MahjongTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 648Accepted Submission(s): 111Problem DescriptionJapanese Mahjong is a four-player game. The game needs four people to sit around a desk and play with a set of Mahjong tiles. A set of Mahjong t
阅读全文
摘要:lockerTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 248Accepted Submission(s): 87Problem DescriptionA password locker with N digits, each digit can be rotated to 0-9 circularly.You can rotate 1-3 consecutive digits up or down in one step.For exam
阅读全文
摘要:Sum of divisorsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 82Accepted Submission(s): 35Problem Descriptionmmm is learning division, she's so proud of herself that she can figure out the sum of all the divisors of numbers no larger than 100
阅读全文
摘要:HuntersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21Accepted Submission(s): 17Problem DescriptionAlice and Bob are the topmost hunters in the forest, so no preys can escape from them. However, they both think that its hunting skill is better t
阅读全文
摘要:F. Spreading the WealthProblemA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properties to coins of equal value, such that the total number of coins is divisible by the numbe
阅读全文
摘要:There is a war and it doesn't look very promising for your country. Now it's time to act. You have a commando squad at your disposal and planning an ambush on an important enemy camp located nearby. You have N soldiers in your squad. In your master-plan, every single soldier has a unique res
阅读全文
摘要:Problem C: The Dragon of LoowaterOnce upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to the lack of predators, the geese population was out of control. The peo
阅读全文
摘要:Tian Ji -- The Horse RacingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11572Accepted Submission(s): 3239Problem DescriptionHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the
阅读全文
摘要:What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 7959Accepted Submission(s): 2479Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian
阅读全文
摘要:Catching FishTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 943Accepted Submission(s): 335Problem DescriptionIgnatius likes catching fish very much. He has a fishnet whose shape is a circle of radius one. Now he is about to use his fishnet to cat
阅读全文
摘要:FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2859Accepted Submission(s): 1118Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is label
阅读全文
摘要:Calendar GameTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1457Accepted Submission(s): 812Problem DescriptionAdam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebratio
阅读全文
摘要:Split the RectangleTime Limit: 2 Seconds Memory Limit: 32768 KBAlice comes up with a new game and wants to play with Bob.There is one rectangle on the paper initially, we define its lower-left corner's coordinate is (xL, yL) and upper-right corner's coordinate is (xR, yR).Bob has executed th
阅读全文
摘要:Math MagicTime Limit: 3 Seconds Memory Limit: 32768 KBYesterday, my teacher taught us about math: +, -, *, /, GCD, LCM... As you know, LCM (Least common multiple) of two positive numbers can be solved easily because of a * b = GCD (a, b) * LCM (a, b).In class, I raised a new idea: "how to calcu
阅读全文
摘要:Conquer a New RegionTime Limit: 5 Seconds Memory Limit: 32768 KBThe wheel of the history rolling forward, our king conquered a new region in a distant continent.There are N towns (numbered from 1 to N) in this region connected by several roads. It's confirmed that there is exact one route betwee
阅读全文
摘要:2012年ACM长春赛区区域赛结束了,这是今年的第一场区域赛。也意味着我今年在国内的比赛结束了(下一个赛区是去泰国的赛区)先记一下流水账:10月12日: 11:30的飞机去长春,8:00就开始出发去机场了。坐了两个多小时的飞机,感觉很爽。到了长春打车1个小时到了东师会馆注册、领衣服、抽签~~~~~然后入住了五星级宾馆——海航名门饭店。五星级的也就这样吧,没有感觉很好。但是服务和早餐真的很棒啊,有么有!10月13日:6点多就醒来了,然后就一直睡不着了。。。等待所有人都起来后,8点多去吃早餐,真的是暴豪华的早餐啊~~然后就去周边逛了下。去看了满洲国务院,去了文化广场。然后回到东北师范大学去吃午餐了
阅读全文
摘要:Yukari's BirthdayTime Limit: 2 Seconds Memory Limit: 32768 KBToday is Yukari's n-th birthday. Ran and Chen hold a celebration party for her. Now comes the most important part, birthday cake! But it's a big challenge for them to place n candles on the top of the cake. As Yukari has lived
阅读全文
摘要:The Little Girl who Picks MushroomsTime Limit: 2 Seconds Memory Limit: 32768 KBIt's yet another festival season in Gensokyo. Little girl Alice planned to pick mushrooms in five mountains. She brought five bags with her and used different bags to collect mushrooms from different mountains. Each b
阅读全文
摘要:Bit MagicTime Limit: 8 Seconds Memory Limit: 32768 KBYesterday, my teacher taught me about bit operators: and (&), or (|), xor (^). I generated a number table a[N], and wrote a program to calculate the matrix table b[N][N] using three kinds of bit operator. I thought my achievement would get tea
阅读全文
摘要:作者:Dong | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址:http://dongxicheng.org/structure/splay-tree/1、 概述二叉查找树(Binary Search Tree,也叫二叉排序树,即Binary Sort Tree)能够支持多种动态集合操作,它可以用来表示有序集合、建立索引等,因而在实际应用中,二叉排序树是一种非常重要的数据结构。从算法复杂度角度考虑,我们知道,作用于二叉查找树上的基本操作(如查找,插入等)的时间复杂度与树的高度成正比。对一个含n个节点的完全二叉树,这些操作的最坏情况运行时间为O(log n)。但如果因
阅读全文
摘要:Eliminate the ConflictTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 740Accepted Submission(s): 301Problem DescriptionConflicts are everywhere in the world, from the young to the elderly, from families to countries. Conflicts cause quarrels, fight
阅读全文
摘要:Katu PuzzleTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5749Accepted: 2077DescriptionKatu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an integer c (0 ≤ c ≤ 1). One Katu is solvable if one can find each
阅读全文
摘要:WeddingTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5880Accepted: 1802Special JudgeDescriptionUp to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, opposite each other, and the bride wears an ela
阅读全文
摘要:Time travelTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 517Accepted Submission(s): 80Problem DescriptionAgent K is one of the greatest agents in a secret organization called Men in Black. Once he needs to finish a mission by traveling through ti
阅读全文
摘要:Card CollectorTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1405Accepted Submission(s): 624Special JudgeProblem DescriptionIn your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you colle
阅读全文
摘要:Help Me EscapeTime Limit: 2 Seconds Memory Limit: 32768 KBBackgroundIf thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and thou shalt rule over him. And Cain talked with Abel his brother: and it came to pass, when th.
阅读全文
摘要:Patchouli's Spell CardsTime Limit: 7 Seconds Memory Limit: 65536 KBPatchouli Knowledge, the unmoving great library, is a magician who has settled down in the Scarlet Devil Mansion (紅魔館). Her specialty is elemental magic employing the seven elements fire, water, wood, metal, earth, sun, and moon.
阅读全文
摘要:Map LabelerTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1023Accepted: 337DescriptionMap generation is a difficult task in cartography. A vital part of such task is automatic labeling of the cities in a map; where for each city there is text label to be attached to its location, so that n
阅读全文
摘要:Ikki's Story IV - Panda's TrickTime Limit: 1000MSMemory Limit: 131072KTotal Submissions: 6065Accepted: 2234Descriptionliympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such easy games and wants to play
阅读全文
摘要:【2-SAT问题】现有一个由N个布尔值组成的序列A,给出一些限制关系,比如A[x]AND A[y]=0、A[x]OR A[y]OR A[z]=1等,要确定A[0..N-1]的值,使得其满足所有限制关系。这个称为SAT问题,特别的,若每种限制关系中最多只对两个元素进行限制,则称为2-SAT问题。由于在2-SAT问题中,最多只对两个元素进行限制,所以可能的限制关系共有11种:A[x]NOT A[x]A[x] AND A[y]A[x] AND NOT A[y]A[x] OR A[y]A[x] OR NOT A[y]NOT (A[x] AND A[y])NOT (A[x] OR A[y])A[x] X
阅读全文
摘要:Bomb GameTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2294Accepted Submission(s): 769Problem DescriptionRobbie is playing an interesting computer game. The game field is an unbounded 2-dimensional region. There are N rounds in the game. At each
阅读全文
摘要:/*#pragma comment(linker, "/STACK:10240000000000,10240000000000")*/#include<stdio.h>#include<algorithm>#include<iostream>#include<string.h>using namespace std;const int MAXN=200010;struct Node{ int to,next; int len;}edge[MAXN*2];int head[MAXN];int tol;int num[MAXN];
阅读全文
摘要:MissileTime Limit: 2 Seconds Memory Limit: 65536 KBYou control N missile launching towers. Every tower has enough missiles, but for each tower only one missile can be launch at the same time. Before the launching, every missile need T1 seconds to leave the tower. Assume that all the missiles have t.
阅读全文
摘要:495. Kids and PrizesTime limit per test: 0.5 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the company organized a contest for kids for the best design of a cardboard bo
阅读全文
摘要:Number StringTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 717Accepted Submission(s): 311Problem DescriptionThe signature of a permutation is a string that is computed as follows: for each pair of consecutive elements of the permutation, write d
阅读全文
摘要:FootballTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1934Accepted: 958DescriptionConsider a single-elimination football tournament involving 2n teams, denoted 1, 2, …, 2n. In each round of the tournament, all teams still in the tournament are placed in a list in order of increasing index
阅读全文
摘要:D. Bag of micetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the pri
阅读全文
摘要:Check the difficulty of problemsTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 3191Accepted: 1416DescriptionOrganizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. A
阅读全文
摘要:LOOPSTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 649Accepted Submission(s): 267Problem DescriptionAkemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl).Homura wants to help her friend Madoka save the world. But because of the plot of the
阅读全文
摘要:MazeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 957Accepted Submission(s): 307Special JudgeProblem DescriptionWhen wake up, lxhgww find himself in a huge maze.The maze consisted by N rooms and tunnels connecting these rooms. Each pair of rooms
阅读全文
摘要:ActivationTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 520Accepted Submission(s): 179Problem DescriptionAfter 4 years' waiting, the game "Chinese Paladin 5" finally comes out. Tomato is a crazy fan, and luckily he got the first r
阅读全文
摘要:Aeroplane chessTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 361Accepted Submission(s): 255Problem DescriptionHzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws
阅读全文
摘要:Hou Yi's secretTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 877Accepted Submission(s): 285Problem DescriptionLong long ago, in the time of Chinese emperor Yao, ten suns rose into the sky. They burned the crops and scorched the bushes and tre
阅读全文
摘要:One Person GameTime Limit: 1 Second Memory Limit: 32768 KB Special JudgeThere is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 has K1 faces. Die2 has K2 faces. Die3 has K3 faces. All the dice are fair dice, so the probability of rolling each value..
阅读全文
摘要:Collecting BugsTime Limit: 10000MSMemory Limit: 64000KTotal Submissions: 1244Accepted: 523Case Time Limit: 2000MSSpecial JudgeDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, he
阅读全文
摘要:概率DP主要用于求解期望、概率等题目。转移方程有时候比较灵活。一般求概率是正推,求期望是逆推。通过题目可以体会到这点。首先先推荐几篇参考的论文:《信息学竞赛中概率问题求解初探》《浅析竞赛中一类数学期望问题的解决方法》 《有关概率和期望问题的研究 》1、POJ 3744 Scout YYF I此题是一个用矩阵优化的求概率的题目。主要思想是分段,根据转移方程用矩阵求解。题解见 herePOJ 3744/*POJ 3744C++ 0ms 184K*/#include<stdio.h>#include<string.h>#include<algorithm>#inc
阅读全文
摘要:Scout YYF ITime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3723Accepted: 928DescriptionYYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties, YYF is now at the start of enemy's famous "mine
阅读全文
摘要:这几天学习了一下插头DP,刷了11道题。对插头DP有了点理解。插头DP就先告一段落吧! 后面还有插头DP的广义路径和其它复杂应用,以后有机会再补上吧! kuangbin首先入门推荐的还是cdq的论文:《基于连通性状态压缩的动态规划问题》http://wenku.baidu.com/view/4fe4ac659b6648d7c1c74633.html上面的论文关于插头和轮廓线等概念讲得很清楚。而且关于插头DP的精髓也讲得很透了。插头DP其实就是每格进行状态转移。看懂原理和写代码还是有段距离的,可以结合代码去加深理解原理。同时形成适合自己风格的代码模板。HDU 1693 Eat the Trees
阅读全文
摘要:circuitsTime Limit: 30000/15000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 418Accepted Submission(s): 141Problem Description Given a map of N * M (2 <= N, M <= 12) , '.' means empty, '*' means walls. You need to build K circuits and no circuit
阅读全文
摘要:Beautiful MeadowTime Limit: 5 Seconds Memory Limit: 32768 KBTom's MeadowTom has a meadow in his garden. He divides it into N * M squares. Initially all the squares are covered with grass and there may be some squares cannot be mowed.(Let's call them forbidden squares.) He wants to mow down t
阅读全文
摘要:Problem 1977 Pandora adventureAccept: 246Submit: 816Time Limit: 1000 mSecMemory Limit : 32768 KB Problem DescriptionThe pollution of the earth is so serious that people can not survive any more. Fortunately, people have found a new planet that maybe has life, and we call it "Pandora Planet"
阅读全文
摘要:Eat the TreesTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1663Accepted Submission(s): 783Problem DescriptionMost of us know that in the game called DotA(Defense of the Ancient), Pudge is a strong hero in the first period of the game. When the ga
阅读全文
摘要:Tour in the CastleTime Limit: 5 Seconds Memory Limit: 32768 KBAfter the final BOSS is defeated, the hero found that the whole castle is collapsing (very familiar scene, isn't it). Escape from the castle is easy, just need to cross a few rooms. But as the Hero is full of adventurous spirit, he de
阅读全文
摘要:PlanTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 449Accepted Submission(s): 151Problem DescriptionOne day, Resty comes to an incredible world to seek Eve -- The origin of life. Lilith, the sister of Eve, comes with him. Although Resty wants to f
阅读全文