Codeforces Round #257 (Div. 2) D. Jzzhu and Cities

别再只盯着RPC了!聊聊SOME/IP在车载以太网里怎么选UDP还是TCP(附实战避坑指南) 本文深入探讨了SOME/IP协议在车载以太网中选择UDP或TCP的决策框架,提供了详细的性能对比和实战优化指南。通过分析实时性、可靠性和灵活性需求,帮助开发者根据具体场景选择最佳传输协议,并附有代码示例和常见问题解决方案,提升车载网络通信效率。 阅读详情

D. Jzzhu and Cities
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One can use the i-th train route to go from capital of the country to city si (and vise versa), the length of this route is yi.

Jzzhu doesn't want to waste the money of the country, so he is going to close some of the train routes. Please tell Jzzhu the maximum number of the train routes which can be closed under the following condition: the length of the shortest path from every city to the capital mustn't change.

Input

The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105).

Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109).

Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109).

It is guaranteed that there is at least one way from every city to the capital. Note, that there can be multiple roads between two cities. Also, there can be multiple routes going to the same city from the capital.

Output

Output a single integer representing the maximum number of the train routes which can be closed.

Sample test(s)
Input
5 5 3
1 2 1
2 3 2
1 3 3
3 4 4
1 5 5
3 5
4 5
5 5
Output
2
Input
2 2 3
1 2 2
2 1 3
2 1
2 2
2 3
Output
2

  有N个地方,M条线路,K条火车路(从1出发)。最多删掉多少火车路使1到每个点的最短路不变。

  用dijkstra的思路,优先队列每次找出d最小的。先用火车路更新最小的d。当u的最短路确定的时候,若还是那个火车路,没有被别的路更新,说明这条火车路不能删,若这条路已经被更新过,说明火车路能删。

  怎么判断一个点有没有被更新过呢,这里有个巧妙的方法,一开始把节点编号的负值加到优先队列中,如果最后确定最短路的时候还是负值说明没有被更新过。

  有一点要注意,更新条件是d[v]>=d[u]+w,因为如果出现和火车路长度相同的路也要更新,因为这样也可以把火车路删掉。

  把d加入队列的时候可以加d的负值,因为默认的优先队列是先pop大的,负的最大就是正的最小。

#include<iostream>
#include<algorithm>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#define INF 0x3f3f3f3f
#define MAXN 200010
#define MAXM 1000010
#define MOD 1000000007
#define MAXNODE 500010
#define sigma_size 28
#define eps 1e-9
using namespace std;
typedef long long LL;
LL N,M,K,d[MAXN],vis[MAXN];
vector<pair<LL,LL> > V[MAXN];
priority_queue<pair<LL,LL> >q;
int main(){
    freopen("in.txt","r",stdin);
    while(cin>>N>>M>>K){
        LL u,v,w;
        for(LL i=1;i<=N;i++) V[i].clear();
        while(!q.empty()) q.pop();
        for(int i=0;i<=N;i++) d[i]=1e18;
        memset(vis,0,sizeof(vis));
        while(M--){
            cin>>u>>v>>w;
            V[u].push_back(make_pair(v,w));
            V[v].push_back(make_pair(u,w));
        }
        while(K--){
            cin>>v>>w;
            d[v]=min(d[v],w);
            q.push(make_pair(-w,-v));
        }
        q.push(make_pair(0,1));
        d[1]=0;
        LL ans=0;
        while(!q.empty()){
            LL u=q.top().second,w=-q.top().first;
            q.pop();
            if(u<0){
                u=-u;
                if(vis[u]) ans++;
            }
            if(vis[u]) continue;
            vis[u]=1;
            LL L=V[u].size();
            for(LL i=0;i<L;i++){
                LL v=V[u][i].first,w=V[u][i].second;
                if(d[v]>=d[u]+w){
                    d[v]=d[u]+w;
                    q.push(make_pair(-d[v],v));
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Python对接海康威视机器视觉工业相机 工业相机只允许单条连接,也就是说MVS如果连接了相机,python代码就无法获取数据,此时必须。相机工具类(读者直接复制)HKCamera_class.py。博主这里出现了一个警告:获取不到相机参数。四、使用Pycharm打开Python代码示例文件夹。三、找到MVS示例代码(代码在MVS的安装位置)二、解压并安装MVS客户端。一、下载MVS客户端。安装一下opencv。 阅读详情

相关推荐

AI量化投资开源平台——Qlib(微矿)的学习使用笔记(随缘更新)

Qlib 涵盖了量化投资的全过程,为用户的 AI 算法提供了高性能的底层基础架构,从框架设计上让用户可以更容易地应用 AI 算法来辅助解决量化投资的各个关键问题(例如 Alpha 预测,风险预测,市场动态性建模)。本文旨在记录一些面向初学者的基础内容。

in_void的博客 3133

c++dijkstra算法_最短路专题2 | CodeForces 449B SPFA算法

最短路专题2 | CodeForces 449B - SPFA算法B. Jzzhu and Cities Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m road...

weixin_39628041的博客 292

基于奥比中光Orbbec Astra Pro与ROS实现实时3D环境建模:orb_slam2实战指南

本文提供了一份详细的实战指南,介绍如何使用奥比中光Orbbec Astra Pro深度摄像头与ROS系统,部署并运行ORB-SLAM2算法,实现实时3D环境建模与定位。内容涵盖从驱动安装、环境配置、算法编译到摄像头标定与性能调优的全流程,旨在帮助开发者快速搭建一套高性价比的视觉SLAM系统。

weixin_29054399的博客 334

【题解】Jzzhu and Cities CodeForces - 449B【最短路】 ⭐⭐⭐

Jzzhu and Cities CodeForces - 449B Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the citie...

Suprit's blog 989

LM339 vs LM358:手把手教你选对比较器和运放(附电路设计避坑指南)

本文深入比较了LM339比较器与LM358运算放大器的核心差异,包括内部架构、输出结构和典型应用场景。通过实测数据和电路设计案例,揭示了选型要点和常见设计陷阱,帮助工程师在电源监控、传感器信号调理等场景中做出正确选择。

convnet3designer的博客 355

走马观碑组智能车竞赛:目标板识别算法优化与实战技巧(基于OpenCV)

本文针对智能车竞赛走马观碑组别的核心挑战,深入探讨了基于OpenCV的目标板识别算法优化与实战技巧。文章系统分析了PVC赛道环境下的光照、运动模糊等干扰因素,详细拆解了从红色矩形定位、透视校正到特征提取与分类的完整流程,并提供了工程优化、速度提升及现场调试的实用策略,旨在帮助参赛队伍构建一套在高速运动中既准又快的鲁棒识别系统。

life6的博客 732

文章标题 CoderForces 450D : Jzzhu and Cities(最短路---spfa)

Jzzhu and CitiesDescription Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One c

Wang_SF2015的博客 539

使用Matlab进行IEEE 33节点潮流计算的NR法实现详解及应用实例

IEEE 33节点系统是一个标准的配电系统模型,广泛用于学术研究和工程应用。该系统由33个节点和37条线路组成,结构复杂,具有代表性。其潮流计算结果可用于验证各种潮流计算方法的准确性和效率。NR法是一种基于迭代求解的潮流计算方法,通过不断迭代求解非线性方程组,直到达到预定的收敛条件。NR法具有收敛速度快、计算精度高的优点,适用于大规模复杂电力系统的潮流计算。

m0_57781768的博客 2070

Jzzhu and Cities (CodeForces - 449B)

Jzzhu and Cities Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from ...

不知所云的博客 406

deap数据集的情绪检测代码环境搭建与实现

deap数据数据集很大

f的博客 4157

讲透 ABAP CDS 注解名称:简单名、结构化名、@ 与 @<、作用域与分组

本文从开发者角度梳理ABAP CDS注解的命名规则与实战写法,重点解析: 语法规则:@与@<的使用场景、结构化命名规范、作用域唯一性要求 评估机制:ABAP运行时与组件框架的注解处理差异 分组技巧:花括号分组简化重复前缀的书写 实战示例:包含完整CDS View Entity(演示注解分组与@<用法)和ABAP报表(读取打印注解) 常见问题:命名错误导致激活失败、框架忽略等注意事项 最后通过航空预订统计案例,展示如何结合多种注解类型实现业务需求。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 261

B. Jzzhu and Cities(最短路+统计到某个最短路方案数)

B. Jzzhu and Cities Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go f...

做一只熊猫不好吗? 629

26.Labview波形图、XY图、强度图使用精讲

1. 波形图基础概念,如何使用,1.1 波形图与波形图表1.2 XY图如何设计、如何使用?1.3 强度图原理、如何使用、使用案例;2. 图形的参数设置2.1 波形图及波形图表的外观设计2.2 XY图的前面板设计2.3 强度图属性设置。

关注我,更多技术问题欢迎私聊~ 7500

Codeforces Round #257 (Div. 2) D Jzzhu and Cities 最短路

D. Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the president of country A. Th

Clearlemon 708

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

Codeforces Round #257 div.2 D or 450D Jzzhu and Cities【最短路】

Codeforces Round #257 div.2 D or 450D Jzzhu and Cities【最短路】

... 1467

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Codeforces Round #257 (Div. 2) D. Jzzhu and Cities

题目链接:http://codeforces.com/contest/450/problem/D 题意:给n个城市、m条公路、k条铁路(铁路只在1号城市与其他城市间)。算出在最短路不变的情况下,最多能去除多少条铁路 算法:最短路 dijkstra 思路: 先把m个公路建图,这样边数达到2*m, 在对k 个铁路建图,进而可以判断边为公路还是铁路。当最短路是公路时,令flag=1; 当最短路为铁路...

凝望的博客 300

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Codeforces Round #257 (Div. 2) D题:Jzzhu and Cities 删特殊边的最短路

D. Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the president of country A. Th

liwei的专栏 1614

Codeforces Round #257(Div.2) D Jzzhu and Cities --SPFA

题意:n个城市,中间有m条道路(双向),再给出k条铁路,铁路直接从点1到点v,现在要拆掉一些铁路,在保证不影响每个点的最短距离(距离1)不变的情况下,问最多能删除多少条铁路 分析:先求一次最短路,铁路的权值大于该点最短距离的显然可以删去,否则将该条边加入图中,再求最短路,记录每个点的前一个点,然后又枚举铁路,已经删去的就不用处理了,如果铁路权值大于该点最短距离又可以删去,权值相等时,该...

weixin_30457881的博客 115

Codeforces Round #257 (Div. 1) B. Jzzhu and Cities(多条最短路)

题目链接 思路:又是一个阅读理解图。。。那么k条火车站居然是建在图里。。。 spfa一遍同时记录一下到各个点的最短路径有几条,有多条的时候也要删去火车站。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=3e5+1; int n,m,k,u,v,w,x[maxn],y...

qq_42479630的博客 179

Codeforces Round #257 (Div. 1) B. Jzzhu and Cities(最短路计数)

题目链接:https://codeforces.com/problemset/problem/449/B 题意:这个国家有n个城市,编号1-n,编号1的城市为首都,城市之间有m条双向道路连接,同时有k条火车路线可以直接让其他城市与首都城市连接,每条火车路线也存在自己的长度,因为火车路线的修建存在一定花费,现在需要保证首都在其余的n-1个城市的距离最短的情况下,去除一些没必要的火车道路,问最多能去...

sugarbliss 226

Codeforces Round #257 (Div. 1)B题Jzzhu and Cities(spfa+slf优化)

题目地址:http://codeforces.com/contest/450/problem/D 这题有重边,需要去重。。sad。当时居然没看见。。 这题只要引入一个最短路条数,然后再遍历火车线,如果最短路与火车线长度相等,此时如果最短路条数是1的话,那说明这个最短路就是火车线,不能去掉,如果最短路条数大于1条,说明除了这条火车线外还有别的跟他同样短的路,可以去掉;如果火车线长度比最短路长的话

scf0920 1526

Codeforces Round #257 (Div. 1) B. Jzzhu and Cities (记录最短路数量)

首先把K条特殊边处理一下,到同一个点的只保留最短的,其余都去掉并维护答案。这样形成一棵树。 然后再把这些边和m条普通边一起跑堆优化的dijkstra,并记录最短路数量。然后对于上一步剩下的每条特殊边,如果最短路长度小于它那一定可以去除,如果最短路长度等于它,就看最短路数量,如果等于1,说明就是这条特殊边,不能删,如果大于1说明有别的路,可以删。下面记录路径写的是简略版,因为本题只关心是不是大于1

Baoli1008的专栏 787

Codeforces Round #257 (Div. 1) B. Jzzhu and Cities

B. Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the president of...

weixin_30800807的博客 89

D. Jzzhu and Cities

http://codeforces.com/contest/450/problem/D 先对公路集合求最短路,再判断铁路集合是否可再次更新d[],如果可以就r-- 1 public class Main { 2 3 public static void main(String[] args) { 4 IO io = ...

ao9795的博客 235

Codeforces 449B Jzzhu and Cities(最短路)

题目链接:Codeforces 449B Jzzhu and Cities 题目大意:Jzzhu是一个国家的总统,这个国家有N座城市,以1为首都,已经存在了M条公路,给定M条路。并且还有K条铁轨,铁轨均有首都出发,连接si,距离为yi。现在Jzzhu想要节省经费,拆除一些铁轨,问说最多能拆除多少个铁轨,要求每座城市与首都的最短距离不变。 解题思路:最短路,多加一个标记数组,每个si标记

不慌不忙、不急不躁 2096
上一篇: uva10828 - Back to Kernighan-Ritchie 约旦高斯消元
下一篇: uva11149 - Power of Matrix 矩阵倍增
小小小小葱
博客等级 码龄14年 22粉丝 266原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值