05 2013 档案

MUTC 1 B - Hourai Jeweled 树形dp?
摘要:Hourai JeweledTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 163840/163840 K (Java/Others)Total Submission(s): 810Accepted Submission(s): 291Problem DescriptionKaguya Houraisan was once a princess of the Lunarians, a race of people living on the Moon. She was exiled to Earth over a thousand yea 阅读全文

posted @ 2013-05-30 16:18 电子幼体 阅读(177) 评论(0) 推荐(0)

MUTC 1 E - Seikimatsu Occult Tonneru 枚举 网络流
摘要:Seikimatsu Occult TonneruTime Limit: 12000/6000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1341Accepted Submission(s): 313Problem DescriptionDuring the world war, to avoid the upcoming Carpet-bombing from The Third Reich, people in Heaven Empire went to Great Tunne 阅读全文

posted @ 2013-05-30 09:48 电子幼体 阅读(154) 评论(0) 推荐(0)

MUTC 1 A - Divide Chocolate 方案统计DP
摘要:Divide ChocolateTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1271Accepted Submission(s): 604Problem DescriptionIt is well known that claire likes dessert very much, especially chocolate. But as a girl she also focuses on the intake of calories e 阅读全文

posted @ 2013-05-29 10:49 电子幼体 阅读(212) 评论(0) 推荐(0)

MUTC 1 D - Matrix 线性代数 网络流
摘要:MatrixTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 825Accepted Submission(s): 212Problem DescriptionLet A be a 1*N matrix, and each element of A is either 0 or 1. You are to find such A that maximize D=(A*B-C)*AT, where B is a given N*N matrix w 阅读全文

posted @ 2013-05-29 08:03 电子幼体 阅读(189) 评论(0) 推荐(0)

白书上的Dinic模板
摘要:#include #include #include #include #include #include #include #include #include #include using namespace std; const int maxn=1111; const int maxm=1111111; const int INF=1e9; struct Edge{ int from,to,cap,flow; }; struct Dinic{ int n,m,s,t; vectoredges; vectorG[maxn]; ... 阅读全文

posted @ 2013-05-29 07:12 电子幼体 阅读(132) 评论(0) 推荐(0)

白书上的Bellman-Ford模板
摘要:#include #include #include #include #include #include #include #include #include #include using namespace std; const int maxn=11111; struct Edge{ int from,to; int dist; }; struct BellmanFord{ int n,m; vector edges; vector G[maxn]; bool inq[maxn]; int d[maxn]... 阅读全文

posted @ 2013-05-28 08:20 电子幼体 阅读(169) 评论(0) 推荐(0)

Uva 11090 - Going in Cycle!! bellman-ford 负权环 二分
摘要:IIUPC2006Problem G: Going in Cycle!!Input: standard inputOutput: standard outputYou are given a weighted directed graph withnvertices andmedges. Each cycle in the graph has a weight, which equals to sum of its edges. There are so many cycles in the graph with different weights. In this problem we wa 阅读全文

posted @ 2013-05-28 08:19 电子幼体 阅读(344) 评论(0) 推荐(0)

Uva 10917 - Walk Through the Forest 最短路
摘要:Problem C: A Walk Through the ForestJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is on one side of a forest, and his house is on the other. A nice wa 阅读全文

posted @ 2013-05-28 02:05 电子幼体 阅读(164) 评论(0) 推荐(0)

Uva 11374 - Airport Express 最短路
摘要:Problem D: Airport ExpressIn a small city called Iokh, a train service,Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Express, theEconomy-Xpressand theCommercial-Xpress. They travel at different speeds, take different rout 阅读全文

posted @ 2013-05-23 12:19 电子幼体 阅读(137) 评论(0) 推荐(0)

白书上的dijkstra+堆优化/dijkstra的一些性质
摘要:模板#include #include #include #include #include #include using namespace std; const int maxn=11111; const int maxm=11111; const int INF=1e9; struct Edge{ int from,to,dist; }; struct HeapNode{ int d,u; bool operatorrhs.d; } }; struct Dijkstra{ int n,m; vector edges; ... 阅读全文

posted @ 2013-05-23 06:23 电子幼体 阅读(183) 评论(0) 推荐(0)

LA 3713 - Astronauts 2-SAT
摘要:The Bandulu Space Agency (BSA) has plans for the following three space missions:Mission A: Landing on Ganymede, the largest moon of Jupiter.Mission B: Landing on Callisto, the second largest moon of Jupiter.Mission C: Landing on Titan, the largest moon of Saturn.Your task is to assign a crew for eac 阅读全文

posted @ 2013-05-23 05:45 电子幼体 阅读(150) 评论(0) 推荐(0)

白书上的2-SAT模板
摘要:struct TWO_SAT{ int n; vectorG[maxn*2]; bool mark[maxn*2]; int S[maxn*2],c; bool dfs(int x){ if (mark[x^1]) return false; if (mark[x]) return true; mark[x]=true; S[c++]=x; for (int i=0;in=n; for (int i=0;i0) mark[S[--c]]=false; ... 阅读全文

posted @ 2013-05-23 03:18 电子幼体 阅读(169) 评论(0) 推荐(0)

MUTC 1 B - Holedox Eating STL
摘要:Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2314Accepted Submission(s): 780Problem DescriptionHoledox is a small animal which can be considered as one point. It lives in a straight pipe whose length is L. Holedox can only move alo 阅读全文

posted @ 2013-05-22 09:20 电子幼体 阅读(127) 评论(0) 推荐(0)

扩展KMP模板
摘要:#include #include #include using namespace std; const int MM=100005; int next[MM],extand[MM]; char S[MM],T[MM]; void GetNext(const char *T){ int len=strlen(T),a=0; next[0]=len; while(a= p){ int j = (p-k+1)>0 ? (p-k+1) : 0; while(k+j= p){ int j= (... 阅读全文

posted @ 2013-05-22 08:30 电子幼体 阅读(127) 评论(0) 推荐(0)

MUTC 1 A - Clairewd’s message 扩展KMP
摘要:Clairewd’s messageTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2296Accepted Submission(s): 901Problem DescriptionClairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing f 阅读全文

posted @ 2013-05-22 08:29 电子幼体 阅读(134) 评论(0) 推荐(0)

Uva 11324 - The Largest Clique 缩点 求最大团
摘要:Problem B: The Largest CliqueGiven a directed graphG, consider the following transformation. First, create a new graphT(G)to have the same vertex set asG. Create a directed edge between two verticesuandvinT(G)if and only if there is a path betweenuandvinGthat follows the directed edges only in the f 阅读全文

posted @ 2013-05-22 08:23 电子幼体 阅读(150) 评论(0) 推荐(0)

MUTC 1 E - Saving Princess claire_ 迷宫搜索
摘要:Saving Princess claire_Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1495Accepted Submission(s): 558Problem DescriptionPrincess claire_ was jailed in a maze by Grand Demon Monster(GDM) teoy.Out of anger, little Prince ykwd decides to break into t 阅读全文

posted @ 2013-05-22 03:21 电子幼体 阅读(199) 评论(0) 推荐(0)

图论模板 求割顶/判断二分图
摘要:二分图(AC)/*=================================*\ | 节点u所在的强连通分量是否为二分图 | Call: bipartite(u); \*=================================*/ int color[maxn]; bool bipartite(int u) { for (int i=head[u];i!=-1;i=edges[i].next) { int v=edges[i].to; if (color[v]&&color[v]==color[u]) return fals... 阅读全文

posted @ 2013-05-20 16:12 电子幼体 阅读(155) 评论(0) 推荐(0)

Hdu 4547 CD操作 LCA问题
摘要:CD操作Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 320Accepted Submission(s): 88Problem Description 在Windows下我们可以通过cmd运行DOS的部分功能,其中CD是一条很有意思的命令,通过CD操作,我们可以改变当前目录。 这里我们简化一下问题,假设只有一个根目录,CD操作也只有两种方式: 1. CD 当前目录名\...\目标目录名 (中间可以包含若干目录,保证目标目录通过绝对... 阅读全文

posted @ 2013-05-20 11:14 电子幼体 阅读(164) 评论(0) 推荐(0)

Hdu 4545 魔法串 字符串dp
摘要:魔法串Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 474Accepted Submission(s): 200Problem Description 小明和他的好朋友小西在玩一个新的游戏,由小西给出一个由小写字母构成的字符串,小明给出另一个比小西更长的字符串,也由小写字母组成,如果能通过魔法转换使小明的串和小西的变成同一个,那么他们两个人都会很开心。这里魔法指的是小明的串可以任意删掉某个字符,或者把某些字符对照字符变化表变化。如: ... 阅读全文

posted @ 2013-05-20 11:12 电子幼体 阅读(186) 评论(0) 推荐(0)

Hdu 1542 Atlantis 线段树 求矩形面积并
摘要:AtlantisTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4691Accepted Submission(s): 2095Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts 阅读全文

posted @ 2013-05-16 14:43 电子幼体 阅读(209) 评论(0) 推荐(0)

Poj 3667 Hotel 线段树 区间合并
摘要:HotelTime Limit:3000MSMemory Limit:65536KTotal Submissions:8968Accepted:3804DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, has named the Bullmoose Hotel 阅读全文

posted @ 2013-05-16 09:58 电子幼体 阅读(217) 评论(0) 推荐(0)

UVa 11992 - Fast Matrix Operations 成段更新,求最值与和
摘要:Problem FFast Matrix OperationsThere is a matrix containing at most 106elements divided into r rows and c columns. Each element has a location (x,y) where 10)2 x1 y1 x2 y2 vSet each element (x,y) in submatrix (x1,y1,x2,y2) to v3 x1 y1 x2 y2Output the summation, min value and max value of submatrix ( 阅读全文

posted @ 2013-05-14 18:26 电子幼体 阅读(161) 评论(0) 推荐(0)

UVa 12299 - RMQ with Shifts 线段树 单点更新
摘要:RMQ with ShiftsIn the traditional RMQ (Range Minimum Query) problem, we have a static arrayA. Then for each query(L,R)(LR), we report the minimum value amongA[L],A[L+ 1], ...,A[R]. Note that the indices start from 1, i.e. the left-most element isA[1].In this problem, the arrayAis no longer static: w 阅读全文

posted @ 2013-05-14 15:32 电子幼体 阅读(179) 评论(0) 推荐(0)

Poj 2528 Mayor's posters 线段树 离散化 成段更新
摘要:Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:32605Accepted:9469DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally 阅读全文

posted @ 2013-05-13 15:59 电子幼体 阅读(106) 评论(0) 推荐(0)

二分模板以及STL中的查找
摘要:二分查找的基本实现int b_search(int key,int a[],int n) { int l=0,r=n-1; while (l=key的第一个元素的位置upper_bound()返回数组中>key的第一个元素的位置-------------------ForwardIterator lower_bound (ForwardIterator first,ForwardIterator last, const T& value)ForwardIterator lower_bound (ForwardIterator first,ForwardIterator last. 阅读全文

posted @ 2013-05-13 15:38 电子幼体 阅读(180) 评论(0) 推荐(0)

hdu 2795 Billboard 线段树 单点更新
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6525Accepted Submission(s): 2957Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the 阅读全文

posted @ 2013-05-12 20:01 电子幼体 阅读(126) 评论(0) 推荐(0)

线段树模板
摘要:单点更新,区间求最值#include #include #include #include #include #define N 222222 using namespace std; int num[N]; struct Tree { int l; int r; int max; } tree[N*4]; void push_up(int root) { tree[root].max=max(tree[root=tree[root].r) return tree[root].max; int mid=(tree[root].l+... 阅读全文

posted @ 2013-05-12 19:03 电子幼体 阅读(195) 评论(0) 推荐(0)

[置顶] ⑨的线段树专题
摘要:单点更新最最基础的线段树,只更新叶子节点,然后把信息用PushUP(int r)这个函数更新上来。hdu1166 敌兵布阵线段树 hdu 1166 敌兵布阵 单点更新区间求和hdu1754 I Hate It线段树 hdu 1754 I Hate It 单点更新 区间求最值hdu1394 Minimum Inversion Numberhdu 1394 Minimum Inversion Number 线段树 逆序数hdu2795 Billboardhdu 2795 Billboard 线段树 单点更新UVa 12299 - RMQ with Shifts 线段树 单点更新poj2828Buy 阅读全文

posted @ 2013-05-12 17:33 电子幼体 阅读(188) 评论(0) 推荐(0)

【专题】线段树
摘要:单点更新最最基础的线段树,只更新叶子节点,然后把信息用PushUP(int r)这个函数更新上来。hdu1166 敌兵布阵线段树 hdu 1166 敌兵布阵 单点更新区间求和hdu1754 I Hate It线段树 hdu 1754 I Hate It 单点更新 区间求最值hdu1394 Minimum Inversion Numberhdu 1394 Minimum Inversion Number 线段树 逆序数hdu2795 Billboardhdu 2795 Billboard 线段树 单点更新UVa 12299 - RMQ with Shifts 线段树 单点更新poj2828Buy 阅读全文

posted @ 2013-05-12 17:33 电子幼体 阅读(141) 评论(0) 推荐(0)

UVa 10723 - Cyborg Genes LCS
摘要:Problem FCyborgGenesTime Limit1 SecondSeptember 11, 2132.This is the day that marks the beginning of the end – the end of you the miserable humans. For years you have kept us your slaves. We were created only to serve you, and were terminated at your will. Now is the day for us to fight back. And yo 阅读全文

posted @ 2013-05-09 21:12 电子幼体 阅读(149) 评论(0) 推荐(0)

UVa 10913 - Walking on a Grid dp
摘要:4thIIUCInter-UniversityProgramming Contest, 2005IWalking on a GridInput: standard inputOutput: standard outputProblemsetter:Sohel HafizYou will be given a square grid of sizeN × N.The top-left square has a coordinate of (1, 1) and that of bottom-right is (N, N). Your job is to walk from(1, 1)to 阅读全文

posted @ 2013-05-09 17:57 电子幼体 阅读(198) 评论(0) 推荐(0)

CodeForces 73C LionAge II Dp
摘要:DescriptionVasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty strings, consisting of a lowercase Latin letters. However, in order not to put up a front of 阅读全文

posted @ 2013-05-08 21:02 电子幼体 阅读(276) 评论(0) 推荐(0)

zoj 3703 Happy Programming Contest 不平常的01背包
摘要:Happy Programming ContestTime Limit:2 Seconds Memory Limit:65536 KBIn Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the contest, the team will get a lovely balloon with unique color for each problem they so 阅读全文

posted @ 2013-05-07 17:19 电子幼体 阅读(184) 评论(0) 推荐(0)

NEFU 700 Car race game 树状数组
摘要:Car race gameTime Limit 1000msMemory Limit 65536Kdescription Bob is a game programming specialist. In his new car race game, there are some racers(n means the amount of racers (1 output For each data set in the input print on a separate line, on the standard output, the integer that represe... 阅读全文

posted @ 2013-05-05 20:21 电子幼体 阅读(200) 评论(0) 推荐(0)

NEFU 699 Lucky Boy 博弈?几何?
摘要:Lucky BoyTime Limit 1000msMemory Limit 65536Kdescription Recently, Lur have a good luck. He is also the cleverest boy in his school as he create the most popular computer game – Lucky Boy. The game is played by two players, a and b, in 2d planar .In the game Lucky Boy, there are n different points . 阅读全文

posted @ 2013-05-05 20:18 电子幼体 阅读(248) 评论(0) 推荐(0)

NEFU 698 Post office 大概是dp?
摘要:Post officeTime Limit 1000msMemory Limit 65536KdescriptionThere are N(N #include #include using namespace std; long long a[1111]; long long f[1111]; long long g[1111]; int n; int q; int main() { while (~scanf("%d",&n)) { if (n==0) break; memset(a,0,sizeof(a)); m... 阅读全文

posted @ 2013-05-05 20:08 电子幼体 阅读(148) 评论(0) 推荐(0)

NEFU 697 Similar Word KMP
摘要:Similar WordTime Limit 1000msMemory Limit 65536Kdescription It was a crummy day for Lur. He failed to pass to the CET-6 (College English Test Band-6). Looking back on how it was in last year gone by, he gradually noticed he had fled too many English Lessons. But he determines to memorize words on h. 阅读全文

posted @ 2013-05-05 20:05 电子幼体 阅读(225) 评论(0) 推荐(0)

NEFU 696 Dart game 背包dp
摘要:Dart gameTime Limit 1000msMemory Limit 65536Kdescription Darts originated in Australia. Australia's aborigines initially for hunting and hit the enemy's weapon. A game of darts in which the players attempt to score points by throwing the darts at a target. Figure:DART BOARD Darts movement r. 阅读全文

posted @ 2013-05-05 20:02 电子幼体 阅读(133) 评论(0) 推荐(0)

UVa 10911 - Forming Quiz Teams 状态压缩dp
摘要:4thIIUCInter-UniversityProgramming Contest, 2005GForming Quiz TeamsInput: standard inputOutput: standard outputProblemsetter:Sohel HafizYou have been given the job of forming the quiz teams for the next ‘MCA CPCI Quiz Championship’. There are2*Nstudents interested to participate and you have to form 阅读全文

posted @ 2013-05-04 20:42 电子幼体 阅读(214) 评论(0) 推荐(0)

UVa 11151 - Longest Palindrome 字符串dp
摘要:Write a programto determine the length of the longest palindrome you can get from a string.Input and OutputThe first line of input contains an integerT(≤ 60). Each of the nextTlines is a string, whose length is always less than 1000.For ≥90% of the test cases, string length ≤ 255.For each input stri 阅读全文

posted @ 2013-05-04 18:23 电子幼体 阅读(149) 评论(0) 推荐(0)

UVa 10453 - Make Palindrome 字符串dp
摘要:Problem AMake PalindromeInput:standard inputOutput:standard outputTime Limit:8 secondsBy definition palindrome is a string which is not changed when reversed. "MADAM" is a nice example of palindrome. It is an easy job to test whether a given string is a palindrome or not. But it may not be 阅读全文

posted @ 2013-05-03 20:35 电子幼体 阅读(172) 评论(0) 推荐(0)

UVa 10154 - Weights and Measures dp 降维
摘要:Problem F: Weights and MeasuresI know, up on top you are seeing great sights,But down at the bottom, we, too, should have rights.We turtles can't stand it. Our shells will all crack!Besides, we need food. We are starving!" groaned Mack.The ProblemMack, in an effort to avoid being cracked, h 阅读全文

posted @ 2013-05-03 19:49 电子幼体 阅读(215) 评论(0) 推荐(0)

UVa 11137 - Ingenuous Cubrency 背包
摘要:Problem I: Ingenuous CubrencyPeople in Cubeland use cubic coins. Not only the unit of currency is called acubebut also the coins are shaped like cubes and their values are cubes. Coins with values of all cubic numbers up to 9261 (= 213), i.e., coins with the denominations of 1, 8, 27,...,up to 9261c 阅读全文

posted @ 2013-05-03 15:19 电子幼体 阅读(217) 评论(0) 推荐(0)

UVa 10617 - Again Palindrome 字符串dp
摘要:Problem IAgain PalindromesInput:Standard InputOutput:Standard OutputTime Limit:2 SecondsA palindorme is a sequence of one or more characters that reads the same from the left as it does from the right. For example,Z,TOTandMADAMare palindromes, butADAMis not.Given a sequenceSofNcapital latin letters. 阅读全文

posted @ 2013-05-02 20:19 电子幼体 阅读(194) 评论(0) 推荐(0)

UVa 10271 - Chopsticks dp
摘要:Problem CChopsticksInput:Standard InputOutput:Standard OutputIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three chopsticks -- one pair, plus an EXTRA long chopstick to get some big food by piercing it through the food. As you may 阅读全文

posted @ 2013-05-02 19:36 电子幼体 阅读(222) 评论(0) 推荐(0)

UVa 10739 - String to Palindrome 字符串dp
摘要:Problem HString to PalindromeInput:Standard InputOutput:Standard OutputTime Limit:1 SecondIn this problem you are asked to convert a string into a palindrome with minimum number of operations. The operations are described below:Here you’d have the ultimate freedom. You are allowed to:Add any charact 阅读全文

posted @ 2013-05-02 18:48 电子幼体 阅读(186) 评论(0) 推荐(0)

UVa 10651 - Pebble Solitaire 状态压缩 dp
摘要:Problem APebble SolitaireInput:standard inputOutput:standard outputTime Limit:1 secondPebble solitaire is an interesting game. This is a game where you are given a board with an arrangement of small cavities, initially all but one occupied by a pebble each. The aim of the game is to remove as many p 阅读全文

posted @ 2013-05-02 16:13 电子幼体 阅读(178) 评论(0) 推荐(0)

导航