Educational Codeforces Round 40 (Rated for Div. 2) C. Matrix Walk time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There is a matrix A of size x × y filled with integers. For every , *A**i, …
人生第二场codeforces.然而遇上了Education场这种东西 Educational Codeforces Round 40 下午先在家里睡了波觉,起来离开场还有10分钟. 但是突然想起来还没报名呢,并且电脑又是开机黑屏什么情况 莫非为之后的凉凉埋下了伏笔? 比赛之前联系了下余翱和叶可禾,似乎都要去切题的样子? 想到第一次有人一起打CF还是有点小激动的.于是果断屏蔽余翱QQ上的刷屏去看A题了. A. Diagonal Walking 非常仔细地把题读了一遍,然后……啥这不是字符串入门题…
Educational Codeforces Round 40 F. Runner's Problem 题意: 给一个$ 3 * m \(的矩阵,问从\)(2,1)$ 出发 走到 \((2,m)\) 的方案数 \(mod 1e9 + 7\), 走的规则和限制如下: From the cell (i, j) you may advance to: (i - 1, j + 1) - only if i > 1, (i, j + 1), or (i + 1, j + 1) - only if i <…
从这里开始 小结 题目列表 Problem A Diagonal Walking Problem B String Typing Problem C Matrix Walk Problem D Fight Against Traffic Problem E Water Taps Problem F Runner's Problem Problem G Castle Defense Problem H Path Counting Problem I Yet Another String Match…
A. Diagonal Walking 题意 将一个序列中所有的\('RU'\)或者\('UR'\)替换成\('D'\),问最终得到的序列最短长度为多少. 思路 贪心 Code #include <bits/stdc++.h> #define F(i, a, b) for (int i = (a); i < (b); ++i) #define F2(i, a, b) for (int i = (a); i <= (b); ++i) #define dF(i, a, b) for (…
http://codeforces.com/contest/954/problem/I 给你两个串s,p,求上一个串的长度为|p|的所有子串和p的差距是多少,两个串的差距就是每次把一个字符变成另一个字符的最小次数,字符最大到f 很明显,如果知道每两个串对应地方不相同的字符就能通过dfs/dsu解出来,那么如何快速的找到所有对应的不匹配的地方呢, 我们先单独考虑两个不同的字符,比如abada中取a,cba中取c,用二进制1代表选取的字符表示就是10101,100,我们用fft来加速这一过程 1 2…
题 OvO http://codeforces.com/contest/954/problem/G 解 二分答案, 对于每个二分的答案值 ANS,判断这个答案是否可行. 记 s 数组为题目中描述的 a 数组 以下为初始化: 首先建一个 个元素到第 i 个元素的和 然后建一个 p 数组,其中 p[i] 代表能射到第 i 个区域的弓箭手数量, p[i] 显然可以由 pre 计算得到 以下是对于二分的每个答案值 ANS,判断这个值是否可行的做法: 创建一个 d 数组, d[i] = p[i] - p[…
G. Castle Defense time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Today you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Thr…
#include<bits/stdc++.h>using namespace std;char s[100007];long long a[100007];long long dp[100007][4];int main(){    int n;    scanf("%d",&n);    scanf("%s",s);    for(int i=0;i<n;i++)        scanf("%lld",&a[…
A. Diagonal Walking time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that th…