aaaaa

Posted rubenisveryhandsome

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了aaaaa相关的知识,希望对你有一定的参考价值。

#include <bits/stdc++.h>
#define oo 1e9
using namespace std;

const int N = 200000 + 3;
int n, tot = 1, head[N], nex[2 * N], tov[2 * N], f[2 * N];
int src, sink, L, dep[N], ans;
bool vis[N];
queue<int>Q;

struct edge {
    
    int u, v, w;
}e[N];

bool cmp(const edge & a, const edge & b) {
    
    return a.w < b.w;
}

void Init( ) {
    
    scanf("%d",& n);
    for(int i = 1;i <= n;i ++) scanf("%d%d%d",& e[i].u, & e[i].v, & e[i].w);
    sort(e + 1, e + n + 1, cmp);
    scanf("%d%d%d",& src, & sink, & L);
}

void add(int u, int v, int fl) {
    
    tot ++; nex[tot] = head[u];
    tov[tot] = v; f[tot] = fl;
    head[u] = tot;
    tot ++; nex[tot] = head[v];
    tov[tot] = u; f[tot] = 0;
    head[v] = tot;
}

bool bfs( ) {
    
    memset(vis, 0, sizeof(vis));
    memset(dep, 0, sizeof(dep));
    dep[src] = 0; vis[src] = true; Q.push(src);
    while(! Q.empty( )) {
        int u = Q.front( ); Q.pop( );
        for(int i = head[u];i;i = nex[i]) {
            int v = tov[i];
            if(vis[v]) continue;
            if(f[i]) {
                vis[v] = true; dep[v] = dep[u] + 1;     Q.push(v);
            }
        }
    }
    return vis[sink];
}

int dfs(int u, int delta) {
    
    if(u == sink) return delta;
    int res = 0;
    for(int i = head[u];i;i = nex[i]) {
        int v = tov[i];
        if(delta && f[i] && dep[v] == dep[u] + 1) {
            int del = dfs(v, min(delta, f[i]));
            res += del; f[i] -= del;
            f[i ^ 1] += del;
        }
    }
    return res;
}

int dinic( ) {
    
    int ans = 0;
    while(bfs( )) ans += dfs(src, oo);
}

void Solve( ) {
    
    for(int i = 1;i <= n;i ++) {
        if(e[i].w < L) add(e[i].u, e[i].v, 1), add(e[i].v, e[i].u, 1);
        else break;
    }
    ans += dinic( );
    memset(head, 0, sizeof(head)); tot = 1;
    for(int i = n;i >= 1;i --) {
        if(e[i].w > L) add(e[i].u, e[i].v, 1), add(e[i].v, e[i].u, 1);
        else break;
    }
    ans += dinic( );
    printf("%d
", ans);
}

int main( ) {
    
    Init( );
    Solve( );
}

 

#include <bits/stdc++.h>
using namespace std;

struct data {
    
    int tag1,tag2,s;
    data(int tag1 = 0,int tag2 = 0,int s = 0):
};

void update(int o) {
    
    if(! tag[2 * o][1] && ! tag[2 * o][2] && ! sum[2 * o]) {
        sum[o] = sum[2 * o + 1]; 
        tag[o][1] = tag[2 * o + 1][1]; tag[o][2] = tag[2 * o + 1][2];
        return ;
    }
    if(! tag[2 * o + 1][1] && ! tag[2 * o + 1][2] && ! sum[2 * o + 1]) {
        sum[o] = sum[2 * o]; 
        tag[o][1] = tag[2 * o][1]; tag[o][2] = tag[2 * o][2];
        return ;
    }
    tag[o][1] = tag[2 * o][1]; tag[o][2] = tag[2 * o + 1][2];
    if(tag[2 * o][2] && tag[2 * o + 1][1]) sum[o] = sum[2 * o] + sum[2 * o + 1] + 1;
    else sum[o] = sum[2 * o] + sum[2 * o + 1];
}

void modify(int o, int l, int r, int pos, int del) {
    
    if(l == r) {
        if(tag) tag[o][del] = 1;
        else {
            tag[o][1] = 0; tag[o][2] = 0; sum[o] = 0;
        }
        return ;
    }
    int mid = (l + r) >> 1;
    if(pos <= mid) modify(2 * o, l, mid, pos, del);
    else modify(2 * o + 1, mid + 1, r, pos, del);
    update(o);
}

void Init( ) {
    
    scanf("%d",& n);
    modify(1, 1, n, 1, 1);
    modify(1, 1, n, n, 2);
}

void Solve( ) {
    
    while(m --) {
        int opt;
        scanf("%d",& opt);
        if(opt == 1) {
            int pos; char x[5];
            scanf("%d%s",& pos, x);
            if(x[0] == () {
                modify(1, 1, n, pos, 1);
            }
            else if(x[0] == )) {
                modify(1, 1, n, pos, 2);
            }
            else modify(1, 1, n, pos, 0);
        }
        else {
            int l,r;
            scanf("%d%d",& l,& r);
            data ans = query(1, 1, n, l, r);
        }
    }
}

int main( ) {
    
    Init( );
    Solve( );
}

 

#include <bits/stdc++.h>
using namespace std;

const int N = 200000 + 3;
int n, tot = 1, head[N], nex[2 * N], tov[2 * N], f[2 * N];
int src, sink, L;

struct edge {
    
    int u, v, w;
}e[N];

bool cmp(const edge & a, const edge & b) {
    
    return a.w < b.w;
}

void Init( ) {
    
    scanf("%d",& n);
    for(int i = 1;i <= n;i ++) scanf("%d%d%d",& e[i].u, & e[i].v, & e[i].w);
    sort(e + 1, e + n + 1, cmp);
    scanf("%d%d%d",& src, & sink, & L);
}

void add(int u, int v, int fl) {
    
    tot ++; nex[tot] = head[u];
    tov[tot] = v; f[tot] = fl;
    head[u] = tot;
    tot ++; nex[tot] = head[v];
    tov[tot] = u; f[tot] = 0;
    head[v] = tot;
}

bool bfs( ) {
    
    memset(vis, 0, sizeof(vis));
    memset(dep, 0, sizeof(dep));
    dep[src] = 0; vis[src] = true; Q.push(src);
    while(! Q.empty( )) {
        int u = Q.front( ); Q.pop( );
        for(int i = head[u];i;i = nex[i]) {
            if(vis[v]) continue;
            if(f[i]) {
                vis[v] = true; dep[v] = dep[u] + 1;     Q.push(v);
            }
        }
    }
    return vis[sink];
}

int dfs(int u, int delta) {
    
    if(u == sink) return delta;
    int res = 0;
    for(int i = head[u];i;i = nex[i]) {
        int v = tov[i];
        if(delta && f[i] && dep[v] == dep[u] + 1) {
            int del = dfs(v, min(delta, f[i]));
            res += del; f[i] -= del;
            f[i ^ 1] += del;
        }
    }
    return res;
}

int dinic( ) {
    
    int ans = 0;
    while(bfs( )) ans += dfs(src, oo);
}

void Solve( ) {
    
    for(int i = 1;i <= n;i ++) {
        if(e[i].w < L) add(e[i].u, e[i].v, 1), add(e[i].v, e[i].u, 1);
        else break;
    }
    ans += dinic( );
    memset(head, 0, sizeof(head)); tot = 1;
    for(int i = n;i >= 1;i --) {
        if(e[i].w > L) add(e[i].u, e[i].v, 1), add(e[i].v, e[i].u, 1);
        else break;
    }
    ans += dinic( );
    printf("%d
", ans);
}

int main( ) {
    
    Init( );
    Solve( );
}

 

以上是关于aaaaa的主要内容,如果未能解决你的问题,请参考以下文章

aaaaa

aaaaa

HttpUrlConnection使用详解--转AAAAA

java如何用正则表达式提取#之间的字符串。例如cc#aaaaa#jdi#bbbbb#ji,需要提取aaaaa和bbbbb两个字符串。

Sn=a+aa+aaa+aaaa+aaaaa+...

Sn=a+aa+aaa+aaaa+aaaaa+...