Codeforces B - Tavas and SaDDas】的更多相关文章

535B - Tavas and SaDDas 方法一:打表大法. 代码1: #include<bits/stdc++.h> using namespace std; ]={,,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,…
题目链接:Tavas and SaDDas Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told…
B. Tavas and SaDDas Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/535/problem/B Description Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. Th…
题目传送门 /* DFS:按照长度来DFS,最后排序 */ #include <cstdio> #include <algorithm> #include <cstring> #include <iostream> #include <cmath> #include <vector> using namespace std; ; const int INF = 0x3f3f3f3f; ] = {, }; int a[MAXN]; in…
B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 每次取出最小的数字,在后面加上一个4或一个7就好; 会发现最后的数字很少的. [代码] #include <bits/stdc++.h> using namespace std; #define ll long long priority_queue <ll,vector <ll>,greater <ll> > dl; vector <ll> v; int main(){ #if…
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…
题目链接 Tavas and Pashmaks 题目大意:n个人比赛,游泳和赛跑,游泳距离S,赛跑R.每个人对应两个速度(陆地和水上的),如果存在S,R,使得第i个人胜利,那么输出i 题目要求输出所有的i 维护一个凸壳即可. #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) #define dec(i, a, b) for (int i(a);…
洛谷题目页面传送门 & 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\) 也可得…
题目链接 又复习了一遍kmp....之前都忘光了 #include<bits/stdc++.h> using namespace std; #define pb(x) push_back(x) #define ll long long #define mk(x, y) make_pair(x, y) #define lson l, m, rt<<1 #define mem(a) memset(a, 0, sizeof(a)) #define rson m+1, r, rt<&…
题意:一个等差数列,首项为a,公差为b,无限长.操作cz是区间里选择最多m个不同的非0元素减1,最多操作t次,现给出区间左端ll,在t次操作能使区间全为0的情况下,问右端最大为多少. 这么一个简单题吞了我3小时的时间.主要是没考虑全. 首先,得出ll位置的值a1,如果a1>t那么不可行. 然后分2种情况. 1.区间长度<=m,那么只要右端<=t就行,否则不行. 2.区间长度>m,区间内元素总和<=m*t,且右端<=t就行,否则不行.这个我猜到了,不过忽略了右端<=…
题意:给出一个无限长度的等差数列(递增),每次可以让从l开始的m个减少1,如果某个位置已经是0了,那么可以顺延到下一位减少1,这样的操作最多t次,问t次操作以后从l开始的最长0序列的最大右边界r是多少. 分析:由题意可以挖掘出两个条件:l~r中最大的值(因为是递增的,即r的值)必定不大于t:同时,t*m要大于或等于这一段的和.那么根据这两个条件进行二分即可. 细节:二分的右端点inf不能设置的太大,否则第一次的mid可能就会爆long long. 代码如下: #include <stdio.h>…
A. 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 operati…
这场比赛并没有打现场,昨天晚上做了ABCD四道题,今天做掉了E题 以前还没有过切完一场比赛的所有题呢~爽~ A. Tavas and Nafas   Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operating system is Tavdroid, and its keyboard doesn't have…
题目链接: http://codeforces.com/problemset/problem/535/D D. Tavas and Malekas time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of…
Tavas and Karafs Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/536/problem/A Description Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kin…
A. Tavas and Nafas Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/535/problem/A Description Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operating syste…
题目传送门 /* 题意:给定一个数列,求最大的r使得[l,r]的数字能在t次全变为0,每一次可以在m的长度内减1 二分搜索:搜索r,求出sum <= t * m的最大的r 详细解释:http://blog.csdn.net/libin56842/article/details/45082747 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> us…
题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight",…
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 …
KMP,先预处理按每个节点标记,扫一遍更新每个匹配位置,最后kmp判断是否有重合而且不相同的地方 注意处理细节,很容易runtime error #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #inclu…
[链接] 我是链接,点我呀:) [题意] 游泳+跑步比赛. 先游泳,然后跑步. 最先到终点的人是winner. 但是现在游泳的距离和跑步的距离长度都不确定. S和R. 给你n个人,告诉你每个人游泳的速度以及它们跑步的速度. 现在问你在改变S,R的情况下,第i个人有没有可能为winner. 输出所有可能为winner的人的编号. [题解] 每个人所花费的时间为\(\frac{S}{si} + \frac{R}{ri}\) 可以看成是向量{S,R}和(\(\frac{1}{si}\),\(\frac…
[链接] 我是链接,点我呀:) [题意] 给你n个位置,然后让你从某些位置开始的|p|个位置,填上p这个字符串. 问你填的时候是否会发生冲突->输出0 否则输出最终n个位置组成的可能的字符串的总数 [题解] 扩展KMP. 画个图会发现. 相邻的两个填写操作. 只要发生了重叠.想要看有没有冲突. 相当于询问从某个位置开始的后缀是否和从0开始的后缀一样. 即看看lcp的长度是否大于等于相交部分即可. 会发现第i-2个字符串如果没有和第i-1个字符串发生冲突. 那么和第i个字符串如果发生了重叠,那么肯…
[链接] 我是链接,点我呀:) [题意] 给你一个规则,让你知道第i根萝卜的高度为si = A+(i-1)*B 现在给你n个询问; 每次询问给你一个固定的起点l; 让你找一个最大的右端点r; 使得l..r这一段能够在t次"m吃操作"内被吃完. [题解] 如果l..r里面的最大值大于t了;则无解 最大值小于等于t的话. 每次可以取m个. 然后可以取t次. 也就是说 这一段里面的和<=m*t; 只要A+(i-1)*B大于1e6了就停下来 最坏情况就是A和B都为1 写个rmq+二分就好…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟题 [代码] #include <bits/stdc++.h> using namespace std; map <int,string> mmap; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", "rt", stdin); #endif mmap[0] = "zero"; mmap[1]…
Tavas and Karafs Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 535C Description Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they…
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…
B. Tavas and Malekas time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n co…