Zju1610 Count the Colors】的更多相关文章

题面: 画一些颜色段在一行上,一些较早的颜色就会被后来的颜色覆盖了. 你的任务就是要数出你随后能看到的不同颜色的段的数目. Input: 每组测试数据第一行只有一个整数n, 1 <= n <= 8000,等于填色的次数 接下来的n行每行有三个非负整数,他们之间用一个空格分开. x1 x2 c x1和x2表示填色段最左边的点和最右边的点, c表示填进的颜色. 所有数字都是在[0..8000]这个范围里的整数. 输入有多组测试数据,最后以文件结束符为结束. Output: 输出的每一行都是最后能看…
Description 画一些颜色段在一行上,一些较早的颜色就会被后来的颜色覆盖了. 你的任务就是要数出你随后能看到的不同颜色的段的数目.  Input 每组测试数据第一行只有一个整数n, 1 <= n <= 8000,等于填色的次数 接下来的n行每行有三个非负整数,他们之间用一个空格分开. x1 x2 c x1和x2表示填色段最左边的点和最右边的点, c表示填进的颜色. 所有数字都是在[0..8000]这个范围里的整数. 输入有多组测试数据,最后以文件结束符为结束.  Output 输出的每…
Count the Colors Time Limit:2000MS    Memory Limit:65536KB    64bit IO Format:%lld & %llu SubmitStatus Description Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is cou…
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: 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…
Count the Colors Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Description Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is…
链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82832#problem/F http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on a line, s…
Count the Colors Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 Description Painting some colored segments on a line, some previously painted segments may be covered by some the subseque…
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…
任意门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=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…
G. Count the Colors Time Limit: 2000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java class name: Main     Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your tas…
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…
F - Count the Colors ZOJ - 1610   思路:调了一个小时,但是发现自己线段树木有写错,颜色统计出了错误.但是不明白自己颜色统计为什么错了. 求大佬指点迷津.思路很简单,就是一个裸的线段树.只要推出样例就做出来了. 以下是两种颜色统计: 这是我的错误的: ;i<=;i++){ ]&&vis[i-]!=-) ans[vis[i-]]++; &&vis[i]!=-) ans[vis[i-]]++; } 后来大佬解决了疑惑,改成酱就对了: ;i&…
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…
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. InputThe first line of each data set contains exactly o…
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…
题目链接:https://vjudge.net/problem/ZOJ-1610 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 firs…
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 Description 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…
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…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1610 https://vjudge.net/contest/318019#problem/F Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting…
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. 输入: The first line of each data set contains exactly on…
1.给了每条线段的颜色,存在颜色覆盖,求表面上能够看到的颜色种类以及每种颜色的段数. 2.线段树区间更新,单点查询. 但是有点细节,比如: 输入: 2 0 1 1 2 3 1 输出: 1 2 这种情况如果不处理,那么由于是检查点的颜色,会检查到0,1,2,3的颜色都为1,认为是一段连续的,就会输出 1 1 需要处理一下,代码中把所有的左端点都+1,避免了这种情况,比较巧妙. 3. #include<iostream> #include<stdio.h> #include<st…
题目大意: 有n次操作,每次都是对一根线中的一段区间进行染色(颜色并不相同),有时候后面的颜色有可能覆盖前面的颜色,问最后涂完色,能看到的颜色有几种,每种颜色有几部分? 解题思路: 这个题目建树的时候有些不同,并不是以点为对象,而是以区间为对象,很明显是对线段树的区间进行操作,更新的时候要以区间为单位,还有就是计算每个区间出现几次的时候可以根据线段树的建树特征对树进行遍历求解. #include <cstdio> #include <cstring> #include <io…
题目链接 题意 : 一根木棍,长8000,然后分别在不同的区间涂上不同的颜色,问你最后能够看到多少颜色,然后每个颜色有多少段,颜色大小从头到尾输出. 思路 :线段树区间更新一下,然后标记一下,最后从头输出. //ZOJ 1610 #include <cstdio> #include <cstring> #include <iostream> using namespace std ; *],lz[*] ,hashh[*],hash1[*]; //void pushup(…
题目链接:http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=1610 题意:给一个长8000的绳子,向上染色.一共有n段被染色,问染色后共有多少不同的色段.注意假如相邻两个线段同色,那么算作一条线段. 线段树区间更新,不需要pushUP操作,因为查询和非叶节点无关.找长线段的时候首先定位最靠左那根,然后判后面是否与前面的线段颜色相等.注意有可能出现两条线段中间没有染色的情况,这时候查询返回一个无关值,这时候重置p即可. #inc…
题目链接 题意:成段染色,初始为0,每次改变一个区间的颜色,求最后每种颜色分别有多少段.颜色按照从 小到大输出. 分析:改变了代码的风格,因为看了学长的博客.直接用数组,可以只是记录节点的编号,因为节点编号 确定了,则l,r也就确定了. #include <iostream> #include <cstdio> #include <vector> #include <cstring> #include <cstdlib> #include <…
有一块很长的画布,现在想在这块画布上画一些颜色,不过后面画的颜色会把前面画的颜色覆盖掉,现在想知道画完后这块画布的颜色分布,比如 1号颜色有几块,2号颜色有几块.... *********************************************************************** 分析:基本上跟帖海报是一样的,不过最后要求输出的是这种颜色的画有几块,可以按照贴海报的方式先做出来,然后对每个点进行查询,不晓得复杂度会不会太高.不过还是先试一下吧. 注意:如果出现 …
所谓的懒操作模板题. 学好acm,英语很重要.做题的时候看不明白题目的意思,我还拉着队友一块儿帮忙分析题意.最后确定了是线段树延迟更新果题.我就欣欣然上手敲了出来. 然后是漫长的段错误.... 第一次看见这种错误,还不知道什么意思,在那儿瞎改了好久也没过.最后看了下别人的代码,才知道这个题不管给的n是几,建树都是按0-8000建树.... 亏我第一次提交之前还跟yyf商量说这道题的n很奇怪,怎么又两个意思.... 我的zoj第一题. #include<stdio.h> #include<…
题意:给一段0-8000的线段染色 问最后 颜色x 有几段 题解:标准线段树  但是没有push_up  最后查询是单点按顺序查询每一个点 考虑过使用区间来维护不同的线段有多少种各色的线段  思路是 两个子区间合并:左子区最右边和右子区最左边如果相同,那么就不变,不同就+1  但是不好维护  所以直接单点查还更方便 注意  染色是染区间不是染点 例如   0  3是染  0 1 2 3这4个数中间的空  如果不考虑清楚这一点就会导致 染了  2-3 颜色1  0 2颜色2   3-4颜色3  0…