• 个人简介

    #include<bits/stdc++.h> #define qwe(i,l,r) for(int i=l;i<=r;++i) #define ewq(i,l,r) for(int i=l;i>=r;--i) #define qwex(i,x) for(int i=(x);i;i=ne[i]) #define mkp make_pair #define You_have_no_eggs 0 #define fir first #define sec second #define int long long #define ll long long #define pii pair<int,int> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ f=ch=='-'?-f:f; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); } return f*x; } int Max(int a,int b){ return a>b?a:b; } int Min(int a,int b){ return a<b?a:b; }

    http://47.113.178.154/

    这个傻逼场均挂分100+

    蜀道艰险😨粮草如何运送🤔北伐空耗国力😔不如效仿 东吴🤓五虎仅剩一人😭谁敢当北伐先锋🤔有何不敢😡既承先帝遗志😏怎能困守不前😡嗯嗯嗯~哈!!😡😡我!!😡魏延😡只进不退!!!😡😡若魏寇将十万之众延当为主公尽歼😡👊纵曹贼举天下进犯👊👊👊😡延亦可勠力拒退为主破敌👊😡😡😡👊如鱼饮水魏文长在此👋😂😂👊尔辈何敢乃尔!😡👊😡👊主公有延助力,何忧汉室难兴?此身搏杀不懈,只为成主公之业😡👊曹贼吴犬,我有何惧哉?😠我尚未全力一搏,又试问谁能阻挡?😡😡👊丞相无需多虑🤫,我定能轻身立功。

    父亲😨您常言😨将军马革裹尸是为荣耀😤额哈谁料😠竟被宵小所害😠孙吴已无我容身之所😡不如行那驱虎吞狼😡待我再起😡必使😤天下英雄俯首😡

    朕为天子👿岂忍威权日去!😫😡 朕行之绝矣😤🖕正是死又何惧!😡👊 权臣震主😔竟视天子于无物!🤬 假以时日🤫必讨司马一族!🤛😈 若安司马于外🤔或则皇权可收🤩 暗蓄忠君之士🤐以待破局之机🤯 手无实权难卫统🤒朦胧成睡,睡去还惊🫠 朕虽不德🫥昧于大道😤思于宇内共臻兹路🤓👆 愿尊前人教诲🫡为一国名帝贤君😎 心愤无所表😔下笔即成篇🤠 弃忧但求醉🥰醒后寻复来🥹 卿当竭命纳忠🙄何为此逾矩之举😡 朕继文帝风流😜亦当效其权略🫡 朕宁拼一死!😡逆贼安敢一战!😡😡😡 朕安可坐受废辱!😡🫴今日当与卿自出讨之!😡👊👊 纵不成身死😵朕亦为太祖子孙!大魏君王!😎🤬 少康诛寒浞以中兴🤔朕夷司马🤓☝未尝不可🤩

    芙宁娜世界第一可爱\color{blue}{芙宁娜世界第一可爱}

    *@=:%@@@@@@#+===++:.#%#**#%%%##%%@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%#=........-===+#+-::-::--:-:=+***-+*+
    #@@*-+%@@@@@@@@@@%%%%@%@@@%%@@@@@@@@@@@@@@@@@@@@@@%####%@@@@@@@%%*:.......=====+**-:---:-:-@@@@%%@@@
    *@%@%*=+*%@@@@@@@@@@@%%%%##**#@@@@@@@@@@@@@@@@%@@@@@%%##**#@@@@@%%%- .....:*+====+#*::--: *@@#*+*%%#
    *@%%%@@#**=:=*######%%%#***#%@@@@@@@@@@@@@@@@@%#@@@@@@@@@@%#%@@@@@@%+......:+**====--==+=.*=+**#+**=
    *@%%%%@@%+=+#%@@@@@@@#**%@@@@@@@@@@@@@@@@@@@@@@%#@@@@@@@@@@@@%@@@@@@@*...... :+#*-:-+==--:=+=:-+=--=
    *%%%@@#==#@@@@@@@@@%*#@@@@@@@@@@%@@@@@@@@@@@@@@@%#%@@@@@@@@@@@%%@@@@@@#:......::+=:*+*-:-*+++:=: #@@
    *@%%*++#@@@@@@@@@@%#@@@@@@@@@@@#%@@@@@@@@@@@@@@@@@%#@@@@@@@@@@@%#@@@@@@%- ....::.:-::-=-*==##-==.%@%
    +*=+*@@@@@@@@@@@@%%@@@@@@@@@@@#%@@@@@@@@@@@@@@@@@@@@%%%@@@@@%@@@@#@@@@@@@+......:.+**+:==+++==*=.@@%
    -*%@@%@@@@@@@@@@%%@@@@@@@@@@@#%@@@@@@@@@@@@@@@@@@%@@@@%%%@@@@%@@@@#%@@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@@@%@@#+*####+%@@@@@@@@@@@@@@@*@@@%####%%@@%*+*+*++*++++*###**%%%%%####%@@@@@@@@@%
    #@@@##@@@@@@@@@@*@@%%%#: ....:=++%@@@@@@@@@@@@@@@*@@@@@@%##+-=#**####**#==+++#@@@@@@%%%%#***#%%@@@@@
    *%#%%@@@@@@@@@@@%+**=.   ..:.. .=+%@@@@@@@@@@@@@@%*@@@@@@@@==%#.   ...-***+++++*####%@@@@@@%#*####@@
    *@@@@@@@@@@@@@@%#*=..-+++==+*#%*-=*#@@@@@@@@@@@@@@%*@@@@@@@#@@+==-. .   :+#%+=+*+*#@@@@@@@@@@@###%*+
    #@@@@@@@@@@@@@*=. :++=-::::::-*@@###*%@@@@@@@@@@@@@@#%@@@@@@@%#@@@=.:::.. :*@%=:-+%@@@@@@@@@@@@@##%=
    *%#%%######**:  :#*::::::-----:=@@@%#**%@@@@@@@@@@@@@##@@@@@@@=:-::+=:::::.:+@@#.  -*##%@@@@@@@@@@#=
    *%%%#+#%#*+*:  *@@%#--==+-+++++-#@@@@@#**%@@@@@@@@@@@@@#%@@@@@#----#%---::::=#@@@-  .:=+++*%@@@@@@@+
    #@@##@@@@@%= :%@%##*=+*#* :###***@@@@@@@%#*#%@@@@@@@@@@@%%%@@@@*-**++=**+=---*@@@@..:=#%%#+=*#%@@@@#
    %%*%@@@@@%+ :@@@+-=+*##%+  *%%###@@@@@@@@@@%#*##%@@@@@@@@@@@%%%@#+********+:-*@@@#-+#%#@%%%#+*+*@@@#
    ++@@@@@@%*..@@@@*+###%%%%++%@@%*@@@@@@@@@@@@@@@%#####%%@@@@@@@%##**###*#**#=+##%@@@%*#*%%@@@*+**+%@#
    -%@@@@@##- -@@@@%+##%%@@@@@@%#*%@@@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%@@@@@@@@@@@@%%%@@@@***@%@@@*+****@#
    +@@@@@@@#+-:#@@@@%##%@@@@%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%#**+++*+-::***+:=**#=:*@@@@@@@@@%
    -++++++**+:+@@@%%%%%*.:=*###%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#**++++******+:+*:-**:=*+++*+:=@@@@@@@@%
    -+++++++-:#@@@@@@%%%%:=-:=+*+++****+*+***@@@@@@@@@@@%%%%%%+-+++*********+:+**+---.=+++++++:=@@@@@@@%
    -=====+:=@@@@@@@@@@@*.=+=-:=***+********=+%############%##-***+=+++++++*:-+++++============.%@@@@@@%
    :----=:-@@@@@@@@@@%=:-=====.-**::=*****+*-###%%%%###%%*=:..===-.=++++++=.=================:-@@@@@@%:
    :----::%%@@@@@@@@+::=------:.+-:-.=++++-. ..:-+*##%#+:   :=+: .-.=+++++-:===-------:---::.=%@@@@@+:.
    .::::.:%%@@%@@@%:.--:::::::::::--.-++=:-=-:.    .:+-   -*#%=:. --:-=+++=.---------:.-===+#@@@%#=:.::
    ...... +%%%%@@@- ::::..=.:::::::..=++-.:-*#*=:...   ..=#+--:::. :::::-==:.:::::::::::-=+++==-:..:::.
    

    原神是不玩的,芙芙是一定要看的

    吾乃古pig国掌管线段树&大样例的神

    #include<bits/stdc++.h> #define qwe(i,l,r) for(int i=l;i<=r;++i) #define ewq(i,l,r) for(int i=l;i>=r;--i) #define qwex(i,x) for(int i=(x);i;i=ne[i]) #define int long long #define mkp make_pair #define You_have_no_eggs 0 #define fir first #define sec second using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ f=ch=='-'?-f:f; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); } return fx; } int Max(int a,int b){ return a>b?a:b; } int Min(int a,int b){ return a<b?a:b; } const int N=205,M=5005,inf=2e18; int h[N],ne[M<<1],t[M<<1],w[M<<1],cnt=1; void add_edge(int x,int y,int z){ t[++cnt]=y; ne[cnt]=h[x]; h[x]=cnt; w[cnt]=z; } int n,m,st,ed; int d[N],a[N]; bool bfs(){ queueq; q.push(st); qwe(i,1,n)d[i]=inf; d[st]=0; a[st]=h[st]; while(!q.empty()){ int u=q.front();q.pop(); for(int e=h[u];e;e=ne[e]){ if(w[e]&&d[t[e]]inf){ a[t[e]]=h[t[e]]; d[t[e]]=d[u]+1; q.push(t[e]); if(t[e]ed)return 1; } } } return 0; } int dfs(int u,int sum){ if(ued)return sum; int op=0; qwex(e,a[u]){ a[u]=e; if(w[e]&&d[u]+1d[t[e]]){ int k=dfs(t[e],Min(w[e],sum)); sum-=k; op+=k; w[e]-=k; w[e^1]+=k; } } return op; } signed main(){ n=read();m=read();st=read();ed=read(); while(m--){ int x=read(),y=read(),z=read(); add_edge(x,y,z); add_edge(y,x,0); } int ans=0; while(bfs()){ ans+=dfs(st,inf); } cout<<ans; // puts("lu lu dick"); // while(1); } / Ah, si je pouvais vivre dans l'eau, le monde serait-il plus beau? Nous pardonneras-tu, ? chère mère? L'eau dans son courant fait danser nos vies. Et la cité, elle nourrit. Ainsi que toi, mon doux amour. Non, le grand amour ne suffit pas. Seul un adieu fleurira. C'est notre histoire de vie, douce et amère. Moi, je suis et serai toujours là, à voir le monde et sa beauté. Et ?a ne changera jamais, jamais...

    Mend your pace, sway to the beat Hands up! Embrace who you wanna be We’re reaching heights unseen Feel the fire deep within You’re the key to where my trust begins Join-my-dream, it’s just the right time Leave it all behind Get ready now Rise Up into my world Renew your definition World so high, let me show And hear my declaration No more ties Off the ground and tap your feet Look, stars are near when you feel the beat We’re bound for a greater height Take a leap into the blazing, Don’t lose yourself in mundanity Join-my-dream, it is the right time Leave it all behind Get ready now (Sing along) Welcome to my world Renew your definition World so high, let me show And hear my declaration No more ties Welcome to my world Renew your definition World so high, let me show Now hear my declaration Welcome to my world Renew your definition World so high, we’ll show and go beyond horizon Side by side */

    #include<bits/stdc++.h> #define qwe(i,l,r) for(int i=l;i<=r;++i) #define ewq(i,l,r) for(int i=l;i>=r;--i) #define qwex(i,x) for(int i=(x);i;i=ne[i]) #define mkp make_pair #define You_have_no_eggs 0 #define fir first #define sec second //#define int long long #define ll long long #define pii pair<int,int> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ f=ch=='-'?-f:f; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); } return fx; } int Max(int a,int b){ return a>b?a:b; } int Min(int a,int b){ return a<b?a:b; } const int N=2e6+5; int c[N][26],cnt=1,a[N],p[N],d[N],ans[N]; char s[N]; void insert(int i){ cin>>(s+1); int n=strlen(s+1),u=1; qwe(i,1,n){ if(!c[u][s[i]-'a'])c[u][s[i]-'a']=++cnt; u=c[u][s[i]-'a']; } a[i]=u; } void bfs(){ qwe(i,0,25)c[0][i]=1; queueq; q.push(1); while(!q.empty()){ int u=q.front();q.pop(); qwe(i,0,25){ if(c[u][i]){ p[c[u][i]]=c[p[u]][i]; q.push(c[u][i]); ++d[p[c[u][i]]]; } else c[u][i]=c[p[u]][i]; } } } void query(){ int u=1; cin>>(s+1); int n=strlen(s+1); qwe(i,1,n){ u=c[u][s[i]-'a']; ++ans[u]; } } void topu(){ queueq; qwe(i,1,cnt)if(!d[i])q.push(i); while(!q.empty()){ int u=q.front();q.pop(); --d[p[u]]; ans[p[u]]+=ans[u]; if(!d[p[u]])q.push(p[u]); } } signed main(){ ios::sync_with_stdio(0); int T; cin>>T; qwe(i,1,T)insert(i); bfs(); query(); topu(); qwe(i,1,T)cout<<ans[a[i]]<<'\n'; } / 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭! 敲响古老塔钟 未来信号连通 我跟着流星雨穿越遥远时空 (出发!) 意料外的旅程 前方困难重重 但我也不放弃寻找属于我的梦 (Let‘s go!) 警告!警告! 有黑草姬正在驶来! 雏草姬需要保护! 警告!警告! 有黑草姬正在驶来! 雏草姬需要保护! 受到不明(触手)攻击! 受到(粘液)攻击! 准备加速!塔菲要冲出来了! 看我打喵拳!好似喵! 现在向我们驶来的是! 王牌级gamer!(哦~!) 王牌级偶像!(哦~!) 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭!(喵耶!) 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲!关注塔菲! 关注塔菲谢谢喵! 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭!(喵耶!) 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲!关注塔菲!关注塔菲谢谢喵! (本世纪王牌级发明家!) 你关注塔菲了嘛!(嗯?) 你关注塔菲了嘛!(嗯!) 这是塔菲!快点关注! 侦探委托太少 每天都吃不饱 头上呆毛缺少营养坚挺不了(嗨呀!) 提纯炼猫药草 香草奶酪小脚 东搞西搞不小心戳到新赛道(呜哇!) 警告!警告! 有黑草姬正在驶来!塔菲需要保护! 警告!警告! 有黑草姬正在驶来!塔菲需要保护! (雏草姬快点保护我!) (雏草姬!雏草姬?我的雏草姬呢?) (雏草姬呢!雏草——哇啊——) 王牌级偶像!王牌级gamer! 王牌级偶像!王牌级gamer! 塔菲!塔菲!塔菲!塔菲! 王牌徽章转动!守护指令启动! 王牌级偶像!王牌级Gamer! 王牌级偶像!王牌级Gamer! 塔菲!塔菲!塔菲!塔菲! 王牌徽章转动!守护指令启动! 各位雏草姬们!(哦!) 派对!就要开始了!(哦!!!) 让蓝星潮汐汹涌! 让雏草编织苍穹! (哇哦!!) 对于你的数据 认真记录整理 对细节测量精确到每一毫米(新纪录!) 陪伴着我的你 在眼底的笑意 就是我本世纪最最最大的发明(嘿!) 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭!(哦耶!) 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲 关注塔菲 关注塔菲谢谢喵! 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭!(喵耶!) 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲 关注塔菲 关注塔菲谢谢喵! (本世纪王牌级发明家!) 关注塔菲喵!关注塔菲谢谢喵! 塔不灭!塔不灭!雏草姬不灭!(喵耶!) 关注塔菲喵!关注塔菲谢谢喵! 关注塔菲 关注塔菲 关注塔菲谢谢喵! 关注塔菲 谢谢喵! */

    #include<bits/stdc++.h> #define qwe(i,l,r) for(int i=l;i<=r;++i) #define ewq(i,l,r) for(int i=l;i>=r;--i) #define qwex(i,x) for(int i=(x);i;i=ne[i]) #define mkp make_pair #define You_have_no_eggs 0 #define fir first #define sec second //#define int long long #define ull unsigned long long #define ll long long #define pii pair<ull,ull> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ f=ch=='-'?-f:f; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); } return f*x; } ll Max(ll a,ll b){ return a>b?a:b; } int Min(int a,int b){ return a<b?a:b; } const int N=1e6+5; int c[N<<1][27],fa[N<<1],len[N<<1]; ll siz[N<<1],ans,cnt=1; int nowp=1; void insert(int x){ int p=nowp;nowp=++cnt; len[nowp]=len[p]+1,siz[nowp]=1; while(p&&!c[p][x]){ c[p][x]=nowp; p=fa[p]; } if(!p)fa[nowp]=1; else{ int q=c[p][x]; if(len[q]==len[p]+1)fa[nowp]=q; else{ int nowq=++cnt; len[nowq]=len[p]+1; fa[nowp]=nowq;fa[nowq]=fa[q];fa[q]=nowq; while(p&&c[p][x]==q){ c[p][x]=nowq; p=fa[p]; } memcpy(c[nowq],c[q],sizeof c[nowq]); } } } vectorg[N<<1]; void dfs(int u){ for(int x:g[u]){ dfs(x); siz[u]+=siz[x]; } if(siz[u]>1)ans=Max(ans,siz[u]*len[u]); } char s[N]; signed main(){ cin>>(s+1); int n=strlen(s+1); qwe(i,1,n)insert(s[i]-'a'); qwe(i,2,cnt)g[fa[i]].push_back(i); dfs(1); cout<<ans; }

    #include<bits/stdc++.h> #define int long long #define qwe(i,l,r) for(int i=l;i<=r;++i) #define ewq(i,l,r) for(int i=l;i>=r;--i) #define qwex(i,x) for(int i=(x);i;i=ne[i]) #define mkp make_pair #define You_have_no_eggs 0 #define fir first #define sec second using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ f=ch=='-'?-f:f; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<3)+(x<<1)+(ch^48); ch=getchar(); } return f*x; } int Max(int a,int b){ return a>b?a:b; } int Min(int a,int b){ return a<b?a:b; } const int N=5e3+5,M=5e4+5,inf=2e18; int n,m,st,ed; int h[N],t[M<<1],ne[M<<1],w[M<<1],c[M<<1],cnt=1; int d[N],a[N],f[N]; bool v[N],vis[N]; int mxfl,cost; void add_edge(int x,int y,int W,int C){ t[++cnt]=y; ne[cnt]=h[x]; h[x]=cnt; w[cnt]=W; c[cnt]=C; } bool bfs(){ queueq;q.push(st); qwe(i,1,n)d[i]=inf; d[st]=0;f[st]=inf; while(!q.empty()){ int u=q.front();q.pop(); v[u]=0; qwex(e,h[u]){ if(w[e]&&d[u]+c[e]<d[t[e]]){ d[t[e]]=d[u]+c[e]; a[t[e]]=e; f[t[e]]=Min(f[u],w[e]); if(!v[t[e]]){ v[t[e]]=1; q.push(t[e]); } } } } return d[ed]!=inf; } void ek(){ mxfl+=f[ed]; for(int u=ed;u!=st;u=t[a[u]^1]){ w[a[u]]-=f[ed]; w[a[u]^1]+=f[ed]; cost+=f[ed]*c[a[u]]; } } signed main(){ n=read();m=read();st=read();ed=read(); while(m--){ int x=read(),y=read(),W=read(),C=read(); add_edge(x,y,W,C); add_edge(y,x,0,-C); } while(bfs())ek(); cout<<mxfl<<' '<<cost; }

  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.

题目标签

系统测试
1