Drainage Ditches POJ - 1273

autoware 激光-相机联合标定 autoware进行激光-相机联合标定 ~~~ 刚开始进行激光-相机联合标定的时候,出现了不少问题,在此记录一下整体标定流程,以防忘记。在此,特别感谢佳明师弟,在录制数据集时提供的帮助。 ~~~ 0.系统配置: Ubuntu18.04系统 ROS Melodic opencv 3.2.0 vlp-16 一.安装autoware 这部分网上教程挺多的,但我在编译的过程中仍存在不少bug,唉~_~。 二.安装calibration_camera_lidar,从a... 阅读详情

Every time it rains on Farmer John’s fields, a pond forms over Bessie’s favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Farmer John has built a set of drainage ditches so that Bessie’s clover patch is never covered in water. Instead, the water is drained to a nearby stream. Being an ace engineer, Farmer John has also installed regulators at the beginning of each ditch, so he can control at what rate water flows into that ditch.
Farmer John knows not only how many gallons of water each ditch can transport per minute but also the exact layout of the ditches, which feed out of the pond and into each other and stream in a potentially complex network.
Given all this information, determine the maximum rate at which water can be transported out of the pond and into the stream. For any given ditch, water flows in only one direction, but there might be a way that water can flow in a circle.
Input
The input includes several cases. For each case, the first line contains two space-separated integers, N (0 <= N <= 200) and M (2 <= M <= 200). N is the number of ditches that Farmer John has dug. M is the number of intersections points for those ditches. Intersection 1 is the pond. Intersection point M is the stream. Each of the following N lines contains three integers, Si, Ei, and Ci. Si and Ei (1 <= Si, Ei <= M) designate the intersections between which this ditch flows. Water will flow through this ditch from Si to Ei. Ci (0 <= Ci <= 10,000,000) is the maximum rate at which water will flow through the ditch.
Output
For each case, output a single integer, the maximum rate at which water may emptied from the pond.
Sample Input
5 4
1 2 40
1 4 20
2 4 20
2 3 30
3 4 10
Sample Output
50

题意:..网络流标准模型… 1是源点 n是汇点 求个最大流2333

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<stack>
#include<functional>
#include<cctype>
using namespace std;
typedef long long ll;

//thanks to pyf ...
//thanks to lmd ...

#define INF 0x3f3f3f3f
#define CLR(a,b) memset(a,b,sizeof(a))
const int N = 5005;

struct Edge
{
    int from,to,cap,flow;
    Edge(int u,int v,int c,int f) : from(u),to(v),cap(c),flow(f){}
};

struct Dinic
{
    int s,t,m,n;
    bool vis[N];
    int d[N];
    int cur[N];
    vector<int>G[N];
    vector<Edge>edges;
    void add_edge(int u,int v,int cap)
    {
        edges.push_back(Edge(u,v,cap,0));
        edges.push_back(Edge(v,u,0,0));
        int m = edges.size();
        G[u].push_back(m-2);
        G[v].push_back(m-1);
    }
    bool bfs()
    {
        memset(vis,0,sizeof(vis));
        queue<int>q;
        q.push(s);
        d[s] = 0;
        vis[s] = 1;
        while(!q.empty())
        {
            int x = q.front();
            q.pop();
            for(int i=0;i<G[x].size();i++)
            {
                Edge &e = edges[G[x][i]];
                if(!vis[e.to]&&e.cap>e.flow)
                {
                    vis[e.to] = 1;
                    q.push(e.to);
                    d[e.to] = d[x] +1;
                }
            }
        }
        return vis[t];
    }
    int dfs(int x,int a)
    {
        if(x==t||a==0)
            return a;
        int flow = 0,f;
        for(int &i = cur[x];i<G[x].size();i++)
        {
            Edge &e = edges[G[x][i]];
            if(d[e.to]==d[x]+1&&(f=dfs(e.to,min(a,e.cap-e.flow)))>0)
            {
                e.flow += f;
                edges[G[x][i]^1].flow -= f;
                flow+=f;
                a-=f;
                if(!a)
                    break;
            }
        }
        return flow;
    }
    int Maxflow(int s,int t)
    {
        this -> s = s;
        this -> t = t;
        int flow = 0;
        while(bfs())
        {
            CLR(cur,0);
            flow+=dfs(s,INF);
        }
        return  flow;
    }
};

int main()
{
    int n,m;
    while(scanf("%d%d",&n,&m)==2)
    {
        Dinic ans;
        for(int i=0;i<n;i++)
        {
            int u,v,d;
            scanf("%d%d%d",&u,&v,&d);
            ans.add_edge(u,v,d);
        }
        int s = 1;
        int t = m;
        printf("%d\n",ans.Maxflow(s,t));
    }
}
从生产订单到整车交付,SAP 离散制造在汽车行业里的真实落点 汽车行业谈数字化,很容易一上来就谈智能工厂、数字孪生、AI 排产、无人仓、视觉质检。可落到 SAP 项目现场,真正把工厂撑起来的,往往还是几个很朴素的问题,客户订单来了以后,BOM 能不能准确展开,物料能不能准时到线,产能有没有被过度承诺,生产订单能不能被车间正确执行,质量问题能不能追溯,成本能不能按工单和批次沉淀下来。 阅读详情

相关推荐

Unity 开发Apple Vision Pro物体识别追踪ObjectTracking

当您在 visionOS 应用中实现对象跟踪时,您可以将现实世界中的物体无缝集成到人们的周围环境中,以增强他们的沉浸式体验。通过跟踪一个或多个物体的 3D 位置和方向,您的应用可以使用虚拟内容增强它们。您可以使用对象跟踪来提供与人周围环境中的对象的虚拟交互,例如:引导某人使用某件物品的功能、阅读其历史或了解其在周围环境中的行为。使用虚拟手册帮助人们解决家居用品和电器的问题。

Cool-浩 1185

最大流 POJ1273 Drainage Ditches

最大流 POJ1273 Drainage Ditches 题目描述:Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes qui...

weixin_30321449的博客 118

机器人运动不流畅?手把手教你用ACCSET调整ABB/FANUC点位加速度

本文针对ABB和FANUC工业机器人运动不流畅、拐角抖动、到位震颤等常见问题,提供了详细的解决方案。核心在于使用ACCSET指令(ABB)或ACC选项(FANUC)调整机器人的点位加速度与减速度参数。文章通过实战案例与系统化调试流程,手把手指导工程师优化运动性能,实现平稳、精准的机器人运动控制。

gpu4optimizer的博客 284

POJ 1273 Drainage Ditches

POJ 1273 Drainage Ditches 题目链接 Description Every time it rains on Farmer John’s fields, a pond forms over Bessie’s favorite clover patch. This means that the clover is covered by water for awhile and ...

旺崽的博客 2488

C语言获取硬件信息(CPU序列号,硬盘序列号,网卡IP、MAC地址、是否插入网线)

本文主要介绍Linux和Windows下使用C语言获取各种硬件信息,包括CPU序列号、硬盘序列号、网卡信息(包括网卡名字、IP地址、MAC地址、网卡是否插入网线等)。

叶落花枯的博客 9378

《手把手教你YOLOv9实战》,改进专栏目录

为了提供友好的操作效果,本专栏将会手把手搭建可视化界面,我将用PyQt5 搭建一个可视化界面,可视化界面能够实现基本的图像加载与检测功能,如支持视频、摄像头,还支持更换不同的 YOLOv9 模型,并适应不同领域(如口罩检测系统、人脸检测系统、工业缺陷检测系统等),界面灵活、功能强大。通过YOLOv9加以改进设计,形成新的算法框架,一起水科研和论文,专栏会一直持续更新中,本专栏适合目标检测、分割、分类。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 2154

POJ 1273 Drainage Ditches(最大流入门)

POJ 1273 Drainage Ditches(最大流入门) http://poj.org/problem?id=1273 题意:        现在有m个池塘(从1到m开始编号,1为源点,m为汇点),及n条有向水渠,给出这n条水渠所连接的点和所能流过的最大流量,求从源点到汇点能流过的最大流量。 分析:        裸的求1点到M点最大流的问题,直接用Dinic算法即可. AC代

code 1612

搞定ESD(四):ESD干扰耦合路径深入分析(二)

静电放电过程中静电干扰主要通过三种间接耦合方式干扰敏感源,即电场耦合、磁场耦合、地弹。前文已经深入分析了静电放电过程中的电场耦合,今天就谈谈静电放电过程中的磁场耦合,也可以理解环路耦合。熟话说的好〝人往高处走,水往低处流〞,静电电流也会选择阻抗最低的路径返回到源端。静电电流流会源端的路径实际上就构成了电流环路,当敏感信号形成的电流环路与静电电流环路存在共环路时,就会将静电放电干扰耦合到敏感信号环路内,干扰敏感信号。

记得诚 2794

POJ-1273-Drainage Ditches

POJ-1273-Drainage Ditches http://poj.org/problem?id=1273 基本的最大流,Ford-Fulkerson算法,按LRJ的白书写的 #include&lt;iostream&gt; #include&lt;cstring&gt; #include&lt;queue&gt; using namespace std; #define INF ...

java开发指南博客 【转载】 144

Luma AI技术浅析(一)

是一款基于人工智能的3D内容生成平台,旨在通过深度学习技术实现高效、高质量的3D场景、物体和动画的生成。Luma AI 主要利用了等技术,以实现从图像、视频到3D模型的转换和生成。

m0_75253143的博客 1728

《手把手教你玩转RTOS操作系统》专栏简介

《手把手教你玩转RTOS操作系统》专栏系统讲解实时操作系统开发,以FreeRTOS为主线,结合RT-Thread和Zephyr对比分析。内容涵盖RTOS基础、任务管理、通信机制、中断处理等核心知识,并配套STM32/ESP32平台实战项目。专栏特色在于零基础友好、实战驱动、多系统对比和行业趋势分析,适合嵌入式开发者进阶RTOS开发能力,解决实际项目中的选型与优化问题。通过完整学习路径,读者可掌握构建高可靠性嵌入式系统的关键技能。

MHD0815的博客 530

Poj 1273 Drainage Ditches(最大流 Edmonds-Karp )

题目链接:poj1273 Drainage Ditches 呜呜,今天自学网络流,看了EK算法,学的晕晕的,留个简单模板题来作纪念、、、 1 #include<cstdio> 2 #include<vector> 3 #include<queue> 4 #include<cstring> 5 #include&...

dhe56357的博客 161

Attention优化|2w字原理&图解: 从Online-Softmax到FlashAttention V1/V2/V3

本文通过原理分析和图解的方式,通俗易懂地FlashAttention系列算法。FlashAttention V1/V2在LLM领域的应用已经非常广泛,相关的论文也反复读了几遍。FA1和FA2论文非常经典,都推荐读一下(不过FA2论文中公式错误不少本文大约1.8w字,包括以下内容:0x07 分布式训推使用FlashAttention0x09 FlashAttention中MQA/GQA以及Causal Mask处理。

具身机器人和通用AI 5232

poj1273 Drainage Ditches

蒟蒻的blogPOJ 1273Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Memory Limit: 10000K Total Submissions: 72327 Accepted: 28143 DescriptionEvery time it rains on Farmer John’s fields, a po

Elijahqi 251

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

POJ-1273 Drainage Ditches(最大流入门)

前述:这周周一做了两个组合数专题的题,依旧是容斥定理的题目,然后就不会了,正好专题延时了,就转向看了看网络流的博客,a了几道最大流的题,有简单的,有比较综合的,也只能不断摸索着前进,简单的构图还是可以想出来的,但是还是没理解拆点的意义所在,就是想不到为什么要拆点,也做了一些简单的尝试,就是把题解上拆点的做法,用不拆点的方法做,可是想法总觉得很好,就是总是wr,看起来我需要用脑子运行一下这个程序,才

m0_37772713的博客 239

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

poj 1273 Drainage Ditches

题目连接 http://poj.org/problem?id=1273 Drainage Ditches Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is ...

dong12276的博客 142

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

HDU1532/POJ1273 Drainage Ditches 最大排水量 网络最大流 EK、Dinic、ISAP算法

题意:为了不让水淹三叶草,现在修了很多排水管,现在问从源点到汇点的最大排水量。

一蓑烟雨 1131

POJ1273 Drainage Ditches

POJ1273 Drainage Ditches Drainage Ditches Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This...

ACMerszl的博客 179

poj_1273_Drainage Ditches

Drainage Ditches Time Limit: 1000MS        Memory Limit: 10000K Total Submissions: 67110        Accepted: 25929 Description Every time it rains on Farmer John's fields, a pond forms over Bessie'

持之以恒_fighting 871

Drainage Ditches POJ1273

Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 93263 Accepted: 36174 试题链接 文章目录Description题意:题解:代码:Dinic做法EK做法 Description Every time it rains on Farmer John’s fields, a pond forms over Bessie’s favorite clover patch. This means that the clo

qq_35975367的博客 471

POJ 1273 Drainage Ditches

Description Every time itrains on Farmer John's fields, a pond forms over Bessie's favorite cloverpatch. This means that the clover is covered by water for awhile and takesquite a long time to regrow

涅槃phy的专栏 877

POJ 1273 Drainage Ditches

Drainage Ditches Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 43977   Accepted: 16541 Description Every time it rains on Farmer John's fields, a pond forms

ACM2272902662的专栏 673
上一篇: Codeforces 427 C. Checkposts
下一篇: PIGS POJ - 1149
OneDay_pyf
博客等级 码龄10年 6粉丝 35原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值