为什么60?

P1001 A+B Problem

feecle6418 @ 2019-08-30 16:36:20

RT

#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i, k, j) for(register int i = (k); i <= (j); i++)
#define INF (1 << 30) - 1
#define ll long long
#define reaD() read()
using namespace std;
inline int read()
{
    int num = 0;char c=' ';
    for(;c>'9'||c<'0';c=getchar());
    for(;c>='0'&&c<='9';num=(num<<1)+(num<<3)+c-48,c=getchar());
    return num;
}
int main(){
    int a=read(),b=read();
    return printf("%d\n",a+b),0;
}

by d3ac @ 2019-09-05 14:23:37

#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#define maxn 500000
#define inf 2139062144
using namespace std;
int n,head[maxn],k=1,l=inf,r,tot,s,t,ans,max_flow,dis[maxn];
bool book[maxn];
struct node{
    int to,next,flow,w;
}edge[maxn];
struct Globin{
    int l,r,val;
}a[maxn];
void add(int u,int v,int flow,int w)
{
    edge[++k]=(node){v,head[u],flow,w}; head[u]=k;
    edge[++k]=(node){u,head[v],0,-w}; head[v]=k;
}
void build(int id,int l,int r)
{
    if(l==r) return ;
    int mid=l+r>>1;
    add(id*2,id,mid-l+1,0); add(id*2+1,id,r-mid,0);
    build(id*2,l,mid); build(id*2+1,mid+1,r);
}
void insert(int id,int l,int r,int ll,int rr,int u,int x)
{
    if(l==ll && r==rr) {add(u,id,1,x); return ;}
    int mid=l+r>>1;
    if(mid>=rr) insert(id*2,l,mid,ll,rr,u,x);
    else if(mid<ll) insert(id*2+1,mid+1,r,ll,rr,u,x);
    else insert(id*2,l,mid,ll,mid,u,x),insert(id*2+1,mid+1,r,mid+1,rr,u,x);
}
queue<int> q;
bool spfa()
{
    memset(book,0,sizeof book);
    memset(dis,~127,sizeof dis);
    q.push(t); dis[t]=0;
    while(!q.empty())
    {
        int u=q.front(); q.pop(); book[u]=0;
        for(int i=head[u];i;i=edge[i].next)
        {
            int v=edge[i].to;
            if(dis[v]<dis[u]-edge[i].w && edge[i^1].flow)
            {
                dis[v]=dis[u]-edge[i].w;
                if(!book[v]) book[v]=1,q.push(v);
            }
        }
    }
    return dis[s]!=-inf;
}
int maxflow(int u,int Max)
{
    book[u]=1;
    if(u==t || !Max) return Max;
    int flow=0;
    for(int i=head[u];i;i=edge[i].next)
    {
        int v=edge[i].to;
        if(book[v] || dis[v]!=dis[u]-edge[i].w || !edge[i].flow) continue;
        int temp=maxflow(v,min(Max-flow,edge[i].flow));
        Max-=flow;
        edge[i].flow-=temp;
        edge[i^1].flow+=temp;
        flow+=temp;
        ans+=edge[i].w*temp;
        if(!Max) return flow;
    }
    return flow;
}
void zkw()
{
    while(spfa())
    {
        book[t]=1;
        while(book[t])
        {
            memset(book,0,sizeof book);
            max_flow+=maxflow(s,inf);
        }
    }
}
int main()
{
//  freopen("data.in","r",stdin);
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d %d %d",&a[i].l,&a[i].r,&a[i].val),a[i].r--,l=min(l,a[i].l),r=max(r,a[i].r);
    tot=(r-l+1)*4+n+1; s=0; t=tot+n+1; add(1,t,r-l+1,0);
    build(1,l,r);
    for(int i=1;i<=n;i++) add(s,tot+i,1,0),insert(1,l,r,a[i].l,a[i].r,tot+i,a[i].val);
    zkw();
    printf("%d\n",ans);
    return 0;
}

by MC_blueberry @ 2019-09-08 17:31:46

各位都是秀儿


by a2454251A @ 2019-11-14 13:32:02

@kkk的忠实舔狗 666


by a2454251A @ 2019-11-14 13:32:32

@Lord_Vodemort 123


by a2454251A @ 2019-11-14 13:51:51

@blueberry_sam 题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:题目:


by a2454251A @ 2019-11-14 13:52:39

@ღ觊觎微凉月


by d3ac @ 2019-11-14 14:28:24

@a2454251A ???


by d3ac @ 2019-11-14 16:50:14

@a2454251A 快读写错了


by d3ac @ 2019-11-14 16:50:44

@a2454251A

....等等,你at我干嘛QWQ


by MC_blueberry @ 2019-11-19 19:57:12

@a2454251A 知道,看到了。。。。


上一页 | 下一页