[CF536D]Tavas in Kansas】的更多相关文章

[CF536D]Tavas in Kansas 题目大意: 一张\(n(n\le2000)\)个点,\(m(m\le10^5)\)条边的无向带权连通图(权值可以为负).A.B两人分别在\(s,t\)点进行博弈.A先手,每次每人可以选择一个数\(x\),并取走到当前位置距离\(\le x\)的点,自己的得分加上这些点的权值之和.每次至少取走一个点,去过的点不能再取.取完所有的点后,得分最高者胜.若每个人都按照最后策略进行游戏,求最后的赢家. 思路: 首先求\(s,t\)的单元最短路.对于每个点,我…
貌似洛谷的题面是没有翻译的 QWQ 大致题面是这个样子,但是可能根据题目本身有不同的地方 完全懵逼的一个题(果然博弈论就是不一样) 首先,我们考虑把题目转化成一个可做的模型. 我们分别从\(s\)和\(t\)跑两边全图最短路,这样,对于每个点,我们就能得到\(dis[i]\)和\(disn[i]\). 这时候,我们把每个图上的点,看成一个平面上的点\((dis[i],disn[i])\),那么对于\(Alice\)来说,一次就相当于取若干行,\(Bob\)就是取若干列.然后两个人最大化分数差 不…
洛谷题目页面传送门 & CodeForces题目页面传送门 A和B在一张无向连通图\(G=(V,E),|V|=n,|E|=m\)上玩一个游戏,节点\(i\)有一个权值\(v_i\).A.B分别站在节点\(a,b\),轮流操作,每次操作选择一个数\(x\),然后选所有到自己所在地最短距离\(\le x\)且没有被选过的点,并把它们的权值累加到自己的分数中,且要满足至少选了\(1\)个点.直到当前玩家无法操作,游戏结束.A为先手,A.B均希望自己的得分更高且按最优策略操作.设A.B的最终得分分别为\…
Codeforces 题目传送门 & 洛谷题目传送门 其实这题本该 2019 年 12 月就 AC 的(详情请见 ycx 发此题题解的时间),然鹅鸽到了现在-- 首先以 \(s,t\) 分别为源点跑两遍 dijkstra 是不可避免的,求出 \(s,t\) 到每个点的最短距离 \(d1_i,d2_i\) 其次还可以发现一件事情,那就是对于 \(\forall i,j\),若 \(d1_i<d1_j\) 并且 \(j\) 被选择了,那么 \(i\) 一定被选择了,对于 \(d2_i\) 也可得…
C. Tavas and Karafs #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <vector> #include <set> #include <map> #include <stack&g…
Tavas and Karafs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almos…
 Tavas and Nafas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operating…
C. Tavas and Pashmaks   Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly …
535D - Tavas and Malekas 题目大意:给你一个模板串,给你一个 s 串的长度,告诉你 s 串中有 m 个模板串并告诉你,他们的其实位置, 问你这样的 s 串总数的多少,答案对1e9+7取模. 我感觉我英语是不是不行啊,我以为他的意思是他里面一共只有m个匹配串,想着没有其他的匹配串,感觉 好麻烦好麻烦好麻烦啊!!!!!! 思路:最暴力的思路,他给你一个匹配串的位置,你就在s串上更新,如果遇到没有已经被更新而且字符不同时 输出0,然后统计剩下的未知字符的个数x,答案就是 (26…
535C - Tavas and Karafs 思路:对于满足条件的r,max(hl ,hl+1 ,hl+2 ,......,hr )<=t(也就是hr<=t)且∑hi<=t*m.所以通过这个条件二分找出最大的r. 二分的下界为1,上界为使得hi等于t的i(hi=t    ==>    a+(i-1)*b=t    ==>    i=(t-a)/b+1) 代码: #include<bits/stdc++.h> using namespace std; #defin…