Codeforces Round #423 (Div. 2)】的更多相关文章

Codeforces Round #423 (Div. 1, rated, based on VK Cup Finals) A.String Reconstruction B. High Load C. DNA Evolution 题意:给定一个只包含A,T,C,G的字符串S,有如下两种操作 1)修改一个点的字母. 2)给定一个字符串e ($\left | e \right |\leq 10$),生成一个由e重复组成的新串,eee...,问$S_{l..r}$中有几个字母跟这个新的字符串一一对应…
codeforces 423 A. Restaurant Tables [水题] //注意,一个人选座位的顺序,先去单人桌,没有则去空的双人桌,再没有则去有一个人坐着的双人桌.读清题意. #include <cstdio> #include <algorithm> #include <cstring> using namespace std; int n, a, b, bb, x; int main() { ; scanf("%d%d%d", &am…
E. DNA Evolution 题目连接: http://codeforces.com/contest/828/problem/E Description Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a seque…
D. High Load 题目连接: http://codeforces.com/contest/828/problem/D Description Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of…
C. String Reconstruction 题目连接: http://codeforces.com/contest/828/problem/C Description Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new strin…
A.题目链接:http://codeforces.com/contest/828/problem/A 解题思路: 直接暴力模拟 #include<bits/stdc++.h> using namespace std; int main() { ,ans=,a[]; cin>>m>>d>>s; ;i<m;i++){ cin>>a[i]; &&d) d--; &&d==&&s){ s--;num+…
Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a sequence of nucleotides. Scientists decided to track evolution of a rare species, wh…
Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly k of t…
Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. Ivan knows some information about the string s. Namely, he re…
Pronlem A In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seate…
题目链接:http://codeforces.com/contest/828 A. Restaurant Tables time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In a small restaurant there are a tables for one person and b tables for two pers…
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i个字符t[i],在k[i]个位置出现过; 且告诉你这k[i]个位置在哪里; 数据不会产生矛盾; 让你输出最终的字符串,输出字典序最小的那个; [Solution] 对于输入的n个子串; 对于每个位置; 看看那个位置有没有子串之前出现过,没有的话,就放在那个位置; 否则,如果当前这个子串ti的长度比原…
[Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子中画一个正方形; (大小,位置自己选但要求覆盖到所有现有的黑棋子); 然后,把里面的白棋子,染成黑棋子; 问你最少需要染多少个白棋子; [Solution] 先得到一个矩形(这个矩形覆盖所有的黑棋子); 然后枚举所需要的正方形的左上角的位置; 这个正方形必然要覆盖这个矩形; 则这个左上角只能在这个正…
[Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个组来餐馆的时候; 按照如下优先顺序安排; ①组内只有一个人的情况 先看有没有空的单人桌,再看有没有空的双人桌,最后看已经有一个人的双人桌 ②组内有两个人的情况 只看双人桌; 如果不能找到符合要求的; 直接拒绝他们的请求; 问:有多少人会被拒绝; [Solution] 注意那里的顺序就好; 另外开一个…
昨晚一个瓜皮说今晚有cf,听说是晚间场,我瞅了一眼,娃,VK Cup,上分的好机会,看着比赛时间就有点心酸了,0:35,当时一直在纠结要不要打的问题,当时想着应该不难吧,要不打一下吧,要不还是看看题先,如果容易就打,难的话就不打了好的吧!于是就这样愉快的决定了.......cf日常延时10分钟,0:45,要不要去睡觉啊,干脆先睡一觉好了,然后又是忍不住诱惑在等待开始! 比赛一开始,瞅了一眼A,这不是一道水题嘛,直接敲啊,然后1分钟就搞定了,交了就过了,B题直接求边界点就好了,扫了一遍就过了,C题…
A:暴力赋值即可,并查集维护下一个未被赋值的位置. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define N 2000010 char getc(){char c=getcha…
D. High Load time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n…
C. String Reconstruction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid…
题目大意:告诉你n个字符串以及这些字符串在字符串s中出现的位置(x1,x2.....xn),要求在满足上述条件的情况下,求出字典序最小的字符串s. 解题思路:主要问题是,如果直接模拟是会超时的,比如vvvvvvvvvv 3 1 2 3这样就有大量重复(因为题目说了这些字符串位置不会相互矛盾,所以已经有了字符的地方可以不用管了),每次都重复了len-1的长度,如果这段字符串长度为1e6那很容易就超时了.所以这里添加一个pre记录上一次字符串的末尾位置(因为题目说了给出的位置时递增的),每次比较一下…
题意跟某道我出的等差子序列求最值非常像…… 反正询问的长度只有10种,你就建立10批树状数组,每组的公差是确定的,首项不同. 然后询问的时候只需要枚举询问串的每一位,找找这一位对应哪棵树状数组即可. 修改的时候会在10棵树状数组里修改,也是算算修改的位置对应哪一棵即可. 要注意,一共有4种字符,每个树状数组其实分成4个,就只需要单点修改,维护前缀和了…… #include<cstdio> #include<cstring> using namespace std; int n,m,…
让你构造一棵树(给定了总结点数和总的叶子数),使得直径最小. 就先弄个菊花图(周围一圈叶子,中间一个点),然后平均地往那一圈放其他的点即可. #include<cstdio> using namespace std; int n,K,Ks[200010],x[200010],y[200010],ans,e; int main(){ scanf("%d%d",&n,&K); for(int i=1;i<=K;++i){ Ks[i]=1; } int no…
在每个给出的子串的起始位置打个标记,记录的是从这里开始的最长子串. 然后输出的时候就扫,如果遇到开始位置,就从这里开始输出,如果其后被更长的覆盖,就跳转到更长的串进行输出. 如果位置没被覆盖,就输出'a'. #include<cstdio> #include<string> #include<algorithm> #include<iostream> using namespace std; string s[100010]; int n,m,p[20000…
DNA Evolution 题目让我们联想到树状数组或者线段树,但是如果像普通那样子统计一段的和,空间会爆炸. 所以我们想怎样可以表示一段区间的字符串. 学习一发大佬的解法. 开一个C[10][10][4][n],就可以啦,第二维表示e的长度,第一维表示i%e的长度,第三维表示颜色,第四维求和了. #include <bits/stdc++.h> using namespace std; ; char s[maxn]; map<char,int> mp; ][][][maxn];…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…