当前位置: 首页 > news >正文

查网站注册信息遵义企业做网站

查网站注册信息,遵义企业做网站,站外推广网站,种子搜索引擎题目大意#xff1a; 有编号1#xff5e;P的站点#xff0c; 有Q条公交车路线#xff0c;公交车路线只从一个起点站直接 到达终点站#xff0c;是单向的#xff0c;每条路线有它自己的车费。有P个人早上从1出发 #xff0c;他们要到达每一个公交站点#xff0c; 然后到…题目大意 有编号1P的站点 有Q条公交车路线公交车路线只从一个起点站直接 到达终点站是单向的每条路线有它自己的车费。有P个人早上从1出发 他们要到达每一个公交站点 然后到了晚上再返回点1。 求所有人来 回的最小费用之和。 分析与总结: 依题意去的时候用单源最短路算法便可求出去时的最小总花费。但是回 来的时候不好办是从各个点到达指定的点1最小花费。如果对于每个点 求一次最短路那么肯定会超时。这时候根据逆向思维反向的再重新建 立图即原先是u--v 变成v--u再用单源最短路算法求出1到所有点 的最短路即可。 队列跑dijkstra反向建图邻接表下标过大输入输出用stdio(iostream超时) In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They have printed invitation cards with all the necessary information and with the programme. A lot of students were hired to distribute these invitations among the people. Each student volunteer has assigned exactly one bus stop and he or she stays there the whole day and gives invitation to people travelling by bus. A special course was taken where students learned how to influence people and what is the difference between influencing and robbery.  The transport system is very special: all lines are unidirectional and connect exactly two stops. Buses leave the originating stop with passangers each half an hour. After reaching the destination stop they return empty to the originating stop, where they wait until the next full half an hour, e.g. X:00 or X:30, where X denotes the hour. The fee for transport between two stops is given by special tables and is payable on the spot. The lines are planned in such a way, that each round trip (i.e. a journey starting and finishing at the same stop) passes through a Central Checkpoint Stop (CCS) where each passenger has to pass a thorough check including body scan.  All the ACM student members leave the CCS each morning. Each volunteer is to move to one predetermined stop to invite passengers. There are as many volunteers as stops. At the end of the day, all students travel back to CCS. You are to write a computer program that helps ACM to minimize the amount of money to pay every day for the transport of their employees.  Input The input consists of N cases. The first line of the input contains only positive integer N. Then follow the cases. Each case begins with a line containing exactly two integers P and Q, 1 P,Q 1000000. P is the number of stops including CCS and Q the number of bus lines. Then there are Q lines, each describing one bus line. Each of the lines contains exactly three numbers - the originating stop, the destination stop and the price. The CCS is designated by number 1. Prices are positive integers the sum of which is smaller than 1000000000. You can also assume it is always possible to get from any stop to any other stop. Output For each case, print one line containing the minimum amount of money to be paid each day by ACM for the travel costs of its volunteers. Sample Input 2 2 2 1 2 13 2 1 33 4 6 1 2 10 2 1 60 1 3 20 3 4 10 2 4 5 4 1 50 Sample Output 46 210 #includeiostream #includestdio.h #includestring.h #includealgorithm #includequeue using namespace std; #define inf 0x3f3f3f3f const int mm1e6; int dp[mm10],a[mm10],b[mm10],c[mm10]; int t,m,n,f[mm10],ne[mm10],book[mm10]; void dfs(int x) {memset(book,0,sizeof(book));memset(dp,inf,sizeof(dp));queueintq;while(!q.empty())q.pop();q.push(x);book[x]1;dp[x]0;while(!q.empty()){int kq.front();q.pop();book[k]0;for(int if[k]; i!-1; ine[i])if(dp[b[i]]dp[a[i]]c[i]){dp[b[i]]dp[a[i]]c[i];if(!book[b[i]]){book[b[i]]1;q.push(b[i]);}}} } int main() {scanf(%d,t);while(t--){memset(f,-1,sizeof(f));/*care*/scanf(%d%d,m,n);for(int i0; in; i){scanf(%d%d%d,a[i],b[i],c[i]);ne[i]f[a[i]];f[a[i]]i;}dfs(1);long long ans0;for(int i1; im; i)ansdp[i];memset(f,-1,sizeof(f));/*care*/for(int i0; in; i)/*反向建图*/{swap(a[i],b[i]);ne[i]f[a[i]];f[a[i]]i;}dfs(1);for(int i1; im; i)ansdp[i];printf(%lld\n,ans);}return 0; }
http://www.yutouwan.com/news/138047/

相关文章:

  • 网站优秀设计站长如何做视频类网站
  • 湖北移动官网网站建设东莞公司网站制作公司
  • 网站关键词排名公司公关是陪吃陪喝的吗
  • 重庆网站建设哪个公司好安徽六安金寨县
  • 外贸鞋的网站建设wordpress要不要套餐
  • 网站建设所需技术wordpress 分类伪静态
  • 手机网站 案例WordPress文章底部广告插件
  • 个人免费网站开发sem优化师底薪一般多少
  • 找个人给我做电影网站seo每天一贴
  • 东莞营销网站建火龙果写作网站
  • 门户网站制作流程博客现在asp做网站
  • 网上做兼职的网站有哪些工作网站备案许可证号查询网站
  • 素材网站可以做淘宝吗网站建设需要考虑的问题
  • 学敏网站建设国际网站建设与维护
  • 怎样在华为云服务器里建设网站沃尔玛超市
  • 网站实名认证功能怎么做做毕业设计的网站设计
  • wordpress 首页描述上海建站 seo
  • 天津非常好的网站建设浙江省网站集约化建设通知
  • 网站后台文章编辑不了最近中国新闻事件
  • 舟山建设银行网站Xammp安装Wordpress
  • wordpress 无法下载主题淄博seo费用
  • 大型网站开发软件网站续费话术
  • 一手楼房可以做哪个网站2022年5月国内重大新闻
  • wordpress 4.0 中文版怀化 优化营商环境
  • 关闭网站后弹窗代码优设网的吉祥物
  • vs2015 asp网站开发中文资源在线官网
  • 西红门网站建设公司营销类网站如何优化
  • iis 设置网站权限公司网站设计思路
  • 网站代码大全荣耀手机官网旗舰店
  • 六站合一的优势备案修改网站名称