D. Stamp Stamp Stamp time limit per test1.5 seconds memory limit per test512 megabytes Cat Noku has a strip of paper that consists of n blank cells lying side by side. He has a painting s he wants to paint. This means, he would like to paint it so that the the i-th cell will ...
D. Around the World time limit per test2 seconds memory limit per test512 megabytes Guy-Manuel and Thomas are planning 144144 trips around the world. You are given a simple weighted undirected connected graph with nn vertexes and mm edges with the following restriction: there isn't any simple...
#include <cstdio>#include<algorithm>usingnamespacestd;constintmaxn = 2e5+5;intcur[maxn];intpre[maxn];intFind(intx) {returnpre[x] == x ?x : Find(pre[x]);}intmain() {intn; scanf("%d",&n);intthread =0;intans =0;for(inti =1; i<=n; i++) pre[i] =i;for(inti =1;...
Problem - D - Codeforces Example input 5 4 1 2 -1 2 3 1 1 -2 5 2 0 -2 2 -1 3 -2 -1 -1 3 -1 -2 -2 output 0 2 3 0 2 0 0 1 1 0 最近赛中敲不出代码, 赛后倒是镇静了, 我也醉了 简
CF1096D Easy Problem [dp] CF1096D Easy Problem 复习了几乎忘光了的dp dp数组是这样子的:\(dp[i][0/1/2/3/4]\)表示前\(i\)个字符,"hard"遍历到了第几个字符的最小代价。 核心代码是这样的: 最后的答案是\(min(dp[n][1/2/3/4])\)。......
题目链接:http://codeforces.com/contest/761/problem/D 题意:有一个序列c由序列a和b构造,c[i] = b[i]-a[i],现告诉你a和b中的元素范围都在l和r内,现告诉你a这个序列的元素,在告诉你c这个序列的排名即p[i]代表c[i]在c中为第几小,问你能否构造出一个b序列来 ...
CF1096D Easy Problem 复习了几乎忘光了的dp dp数组是这样子的:\(dp[i][0/1/2/3/4]\)表示前\(i\)个字符,"hard"遍历到了第几个字符的最小代价。 核心代码是这样的: 最后的答案是\(min(dp[n][1/2/3/4])\)。...Educational Codeforces Round 57 D. Easy Problem(DP?) 题目:https://codefor...
题目链接:https://codeforces.com/contest/1090/problem/D Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and...
以竖切的左半边为例,预处理出左半边每个点向上&向下同色能扩展多长,以及mid上的每个点向左同色能扩展多长len[i]。枚举d=j-i和i,那对于每一对i,j如果len[i]比len[j]长答案就是j上面向上扩展>=j-i的个数,否则就是i上向下扩展能>=j-i的个数。那我们让j-i单调增,给能扩展的长度分别桶排一下(直接...
86d.cpp 8a.cpp 96a.c README.md a.out code.py in in1 in2 longestpalin.py n.cpp out test.cpp Repository files navigation README codeforces solutions Codeforces problem solutions My handle is : http://codeforces.com/profile/misra.ji Please do notify me @ joyneel.mi...