BZOJ1395 : [Baltic2005]Trip】的更多相关文章

建立新图,原图中每条边在新图中是点,新图中每个点的点权为$-e[i].c+e[i].b$,边权为$0$. 若$e[i].d\leq e[j].a$,则连一条$i$到$j$的单向边. 对于原图中每个点,将所有入边和出边分别排序,然后建立一排虚点表示后缀,通过双指针将边数优化至$O(m)$. 在新图中求出最短路,最后将答案加上$T$即可. 注意到新图是个DAG,因此可以记搜求解. 时间复杂度$O(m\log m)$. #include<cstdio> #include<algorithm&g…
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1354 [题目大意] 给出一些车的班次,包括起点,终点,到达起点时间区间, 到达终点时间区间,想要T时刻到达n号点,问最坏情况下的最短等待时间 [题解] 最坏情况就是每次从b时刻才出发,c时刻到达, 那么就相当于地点从x到y,时间从a到d,代价为c-b, 我们求出符合要求的最大代价,然后用最终时间T去减即可 如果没有a和d这个限制,可以直接求最长路即可, 现在考虑如何消除a和d这个时间…
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem 10983 18765 Y 1036 [ZJOI2008]树的统计Count 5293 13132 Y 1588 [HNOI2002]营业额统计 5056 13607 1001 [BeiJing2006]狼抓兔子 4526 18386 Y 2002 [Hnoi2010]Bounce 弹飞绵羊 43…
Text I have just received a letter from my brother,Tim. He is in Australia. He has been there for six months. Tim is an engineer. He is working for a big firm and he has already visited a great number of different places in Australia. He has just bou…
Road Trip Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users: 29, Accepted users: 29 Problem 12882 : No special judgement Problem description You are planning a road trip to visit your friends, each of whom live in…
http://poj.org/problem?id=1041 (题目链接) 题意 给出一张无向图,求字典序最小欧拉回路. Solution 这鬼畜的输入是什么心态啊mdzz,这里用vector储存边,便于边的排序.瞬间变成STL常数boy →_→. 细节 数组大小把握好. 代码 // poj1041 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #incl…
A number of students are members of a club that travels annually to exotic locations. Their destinations in the past have included Indianapolis, Phoenix, Nashville, Philadelphia, San Jose, and Atlanta. This spring they are planning a trip to Eindhove…
Texas Trip Problem's Link:   http://poj.org/problem?id=3301 Mean: 给定n(n <= 30)个点,求出包含这些点的面积最小的正方形的面积. analyse: 首先要确定的是旋转的角度在0到180度之间即可,超过180度是和前面的相同的. 坐标轴旋转后,坐标变换为: X’ = x * cosa - y * sina; y’ = y * cosa + x * sina; Time complexity: O(n) Source code…
Problem C: The Trip Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 19  Solved: 3[Submit][Status][Web Board] Description The Trip A group of students are members of a club that travels annually to different locations. Their destinations in the past hav…
Ant Trip Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Ant Country consist of N towns.There are M roads connecting the towns. Ant Tony,together with his friends,wants to go through every part…