zoj——3624 Count Path Pair】的更多相关文章

Count Path Pair Time Limit: 3 Seconds      Memory Limit: 65536 KB You are given four positive integers m,n,p,q(p < m and q < n). There are four points A(0,0),B(p,0),C(m,q),D(m,n). Consider the path f from A to D and path g from B to C. f and g are a…
思路:在没有限制条件时,很容易知道结果为C(m+n,n)*C(m+q-p,q). 然后再把相交的情况去除就可以了.而如果想到了就是水题了…… 求A->D,B->C相交的情况可以转化为求A->C,B->D的情况. 所以结果就为C(m+n,n)*C(m+q-p,q)-C(m+q,m)*C(m+n-p,n). 代码: #include<cstdio> #include<algorithm> #define M 200001 #define mod 10000000…
ZOJ Problem Set - 1610 Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of dif…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=610  Count the Colors Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 1610 Description Painting some colored segments on a line, some pre…
Count the Colors Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 1610 Description Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent o…
Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can s…
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last. Input The first line of each data set contains exactly…
题目链接 题意 : 一根木棍,长8000,然后分别在不同的区间涂上不同的颜色,问你最后能够看到多少颜色,然后每个颜色有多少段,颜色大小从头到尾输出. 思路 :线段树区间更新一下,然后标记一下,最后从头输出. //ZOJ 1610 #include <cstdio> #include <cstring> #include <iostream> using namespace std ; *],lz[*] ,hashh[*],hash1[*]; //void pushup(…
所谓的懒操作模板题. 学好acm,英语很重要.做题的时候看不明白题目的意思,我还拉着队友一块儿帮忙分析题意.最后确定了是线段树延迟更新果题.我就欣欣然上手敲了出来. 然后是漫长的段错误.... 第一次看见这种错误,还不知道什么意思,在那儿瞎改了好久也没过.最后看了下别人的代码,才知道这个题不管给的n是几,建树都是按0-8000建树.... 亏我第一次提交之前还跟yyf商量说这道题的n很奇怪,怎么又两个意思.... 我的zoj第一题. #include<stdio.h> #include<…
https://cn.vjudge.net/problem/ZOJ-1610 题意 给一个n,代表n次操作,接下来每次操作表示把[l,r]区间的线段涂成k的颜色其中,l,r,k的范围都是0到8000. 分析 把区间看作点,即[3,4]看作点4.查询时进行前序遍历,记录上一段的颜色,不连续的就+1.注意区间的范围可达8000 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstr…