G - Control

https://vjudge.net/contest/402729#problem/G

  You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (the source) to another one (the destination). You know their date, source and destination, and they are using the highway network.
  The highway network consists of bidirectional highways, connecting two distinct city. A vehicle can only enter/exit the highway network at cities only.
  You may locate some SA (special agents) in some selected cities, so that when the terrorists enter a city under observation (that is, SA is in this city), they would be caught immediately.
  It is possible to locate SA in all cities, but since controlling a city with SA may cost your department a certain amount of money, which might vary from city to city, and your budget might not be able to bear the full cost of controlling all cities, you must identify a set of cities, that:
  * all traffic of the terrorists must pass at least one city of the set.
  * sum of cost of controlling all cities in the set is minimal.
  You may assume that it is always possible to get from source of the terrorists to their destination.
------------------------------------------------------------
1 Weapon of Mass Destruction

Input

  There are several test cases.
  The first line of a single test case contains two integer N and M ( 2 <= N <= 200; 1 <= M <= 20000), the number of cities and the number of highways. Cities are numbered from 1 to N.
  The second line contains two integer S,D ( 1 <= S,D <= N), the number of the source and the number of the destination.
  The following N lines contains costs. Of these lines the ith one contains exactly one integer, the cost of locating SA in the ith city to put it under observation. You may assume that the cost is positive and not exceeding 107.
  The followingM lines tells you about highway network. Each of these lines contains two integers A and B, indicating a bidirectional highway between A and B.
  Please process until EOF (End Of File).

Output

  For each test case you should output exactly one line, containing one integer, the sum of cost of your selected set.
  See samples for detailed information.

Sample Input

5 6
5 3
5
2
3
4
12
1 5
5 4
2 3
2 4
4 3
2 1

Sample Output

3

Sponsor

代码:

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
typedef long long ll;
const ll maxn=2e5+10,inf=1<<29;
ll n,m,k,s,t,h[maxn],cur[maxn],cnt=1,vis[maxn];
struct node{
    ll to,nt,w;
}e[maxn];
void add(ll u,ll v,ll w)
{
    e[++cnt]={v,h[u],w};
    h[u]=cnt;
}
queue<ll>q;
bool bfs()
{
    memset(vis,0,sizeof(vis));
    vis[s]=1;
    q.push(s);
    while(!q.empty())
    {
        ll u=q.front();
        q.pop();
        cur[u]=h[u];
        for(ll i=h[u];i;i=e[i].nt)
        {
            ll v=e[i].to,w=e[i].w;
            if(w&&!vis[v])
            {
                vis[v]=vis[u]+1;
                q.push(v);
            }
        }
    }
    return vis[t];

}
ll dfs(ll u,ll flow)
{
    if(u==t)
        return flow;
    ll res=flow;
    for(ll i=cur[u];i;i=e[i].nt)
    {
        ll v=e[i].to,w=e[i].w;
        if(w&&vis[u]+1==vis[v])
        {
            ll now=dfs(v,min(res,w));
            if(!now)
                vis[v]=1;
            else
            {
                e[i].w-=now;
                e[i^1].w+=now;
                res-=now;
            }
        }
        if(!res)
        return flow;
    }
    return flow-res;
}
int a[maxn];
int main()
{
    while(~scanf("%lld %lld %lld %lld",&n,&m,&s,&t))
    {
        memset(cur,0,sizeof(cur));
        memset(h,0,sizeof(h));
        t=t+n;
        cnt=1;
        for(int i=1;i<=n;i++)
        {
            ll w;
            scanf("%lld",&w);
            add(i,i+n,w);
            add(i+n,i,0);
        }
        for(int i=1;i<=m;i++)
        {
            int u,v;
            scanf("%d %d",&u,&v);
            add(u+n,v,inf);
            add(v,u+n,0);
            add(v+n,u,inf);
            add(u,v+n,0);
        }
        ll ans=0;
        while(!q.empty())
            q.pop();
        while(bfs())
        {
            ans+=dfs(s,inf);
            //cout<<ans<<endl;
        }
        printf("%lld\n",ans);
    }

    return 0;
}

 

<think> 嗯,用户这次想深入理解一系列密码控制配置命令的具体含义和用途。从问题细节看,用户应该是网络设备管理员或学习者,正在配置华为交换机的密码策略。之前提供的两个引用片段很有帮助,但用户需要更详细的命令解析。 用户列出的命令清单非常专业,包括启用全局密码策略、修改密码老化规则、调整密码复杂度等关键配置。这说明用户已经具备一定基础,现在需要精确理解每个参数的影响。特别注意到用户询问了undo password-control history enable这类反向命令,以及password-control update-interval 0这种特殊值配置,说明ta在考虑特定场景的灵活性配置。 在解析password-control login-attempt 5 exceed lock-time 10时,需要强调5次失败尝试后账户会被锁定10分钟——这个时间单位容易混淆,必须明确说明。对于password-control composition type-number 3 type-length 1,要解释清楚"3种字符类型各至少1个"的实际含义,比如数字+大写字母+符号的组合。 用户没有提到恢复密码的场景,但根据行业惯例,应该补充说明:账户锁定时需要通过console口本地解绑,避免远程管理被彻底阻断。另外undo password-control change-password first-login enable这个命令涉及首次登录强制改密的安全基线,需要提醒禁用后的风险。 考虑到用户的技术水平,解释password-control update-interval 0时可以用"即时生效"这样直观的描述,而不是单纯说"取消间隔限制"。对于idle-time 0这种危险配置,必须用⚠️符号警示永久不锁定的安全隐患。 最后生成的三个问题都聚焦在配置逻辑上:第一条测试对密码策略整体框架的理解,第二条考察异常场景处理能力,第三条则是高阶的合规性设计。用户如果都能回答,说明已经掌握分层密码策略的精髓。 </think> 以下是华为/H3C交换机密码控制配置命令的详细解析,结合设备管理特性和安全实践: ### 1. **全局策略启用** ```bash password-control enable ``` - **作用**:激活设备全局密码策略,开启后所有本地用户密码强制加密存储(配置文件中不再显示明文密码)[^2] - **关键影响**:关闭此功能时,历史配置的密码将恢复明文显示 ### 2. **密码老化策略** ```bash undo password-control aging enable ``` - **含义**:**禁用**密码有效期限制 - **默认状态**:启用(引用[1]显示默认30天有效期) - **风险提示**:禁用后密码永久有效,降低账户安全性 ### 3. **密码历史记录** ```bash undo password-control history enable ``` - **含义**:**禁用**密码历史记录功能 - **原功能**:防止用户重复使用旧密码(引用[1]默认保存4条历史记录) - **安全影响**:用户可循环使用相同密码 ### 4. **密码长度策略** ```bash password-control length 8 ``` - **作用**:强制密码最小长度为**8字符** - **最佳实践**:通常建议设置为10-12字符(引用[1]默认10字符) ### 5. **密码复杂度规则** ```bash password-control composition type-number 3 type-length 1 ``` - **解析**: - `type-number 3`:密码需包含至少**3种字符类型**(数字/小写字母/大写字母/特殊符号) - `type-length 1`:每类字符至少出现**1个** - **示例**:`Pas$word1` 符合要求(含大写、小写、数字、符号) ### 6. **登录失败保护** ```bash password-control login-attempt 5 exceed lock-time 10 ``` - **安全机制**: - `5`:允许连续失败登录**5次** - `exceed lock-time 10`:超出后锁定账户**10分钟** - **对比默认**:引用[1]中默认仅允许2次失败 ### 7. **密码修改间隔** ```bash password-control update-interval 0 ``` - **含义**:允许用户**立即重复修改密码**(取消最小时间间隔) - **默认限制**:引用[1]要求36小时内不能重复修改 ### 8. **空闲超时控制** ```bash password-control login idle-time 0 ``` - **作用**:**禁用**账户空闲超时锁定 - **默认策略**:引用[1]中30天无操作将锁定账户 - **风险提示**:长期未使用的账户可能被恶意利用 ### 9. **首次登录强制改密** ```bash undo password-control change-password first-login enable ``` - **含义**:**取消**用户首次登录时必须修改密码的要求 - **典型场景**:临时账户或自动化脚本场景使用 - **安全建议**:生产环境强烈建议启用此功能 --- ### 配置逻辑关系图 ```mermaid graph TD A[password-control enable] --> B[激活全局策略] B --> C[密码复杂度规则] B --> D[登录失败保护] B --> E[密码历史记录] B --> F[密码老化策略] D --> G((锁定账户)) F --> H((强制改密)) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值