2017ACM/ICPC广西邀请赛 Color it
Color it
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s):
0
especially messy color paintings. Now Little B is painting. To prevent him from
drawing messy painting, Little D asks you to write a program to maintain
following operations. The specific format of these operations is as
follows.
0
: clear all the points.
1
x
y
c
: add a point which color is c
at point (x,y)
.
2
x
y1
y2
: count how many different colors in the square (1,y1)
and (x,y2)
. That is to say, if there is a point (a,b)
colored c
, that 1≤a≤x
and y1
≤b≤y
2
, then the color c
should be counted.
3
: exit.
Each line
contains a operation. It may be '0', '1 x y c' ( 1≤x,y≤106
,0≤c≤50
), '2 x y1 y2' (1≤x,y1
,y
2
≤10
6
) or '3'.
x,y,c,y1,y2
are all integers.
Assume the last operation is 3 and it appears only
once.
There are at most 150000
continuous operations of operation 1 and operation 2.
There are at most
10
operation 0.
answer .
1 1000000 1000000 50
1 1000000 999999 0
1 1000000 999999 0
1 1000000 1000000 49
2 1000000 1000000 1000000
2 1000000 1 1000000
0
1 1 1 1
2 1 1 2
1 1 2 2
2 1 1 2
1 2 2 2
2 1 1 2
1 2 1 3
2 2 1 2
2 10 1 2
2 10 2 2
0
1 1 1 1
2 1 1 1
1 1 2 1
2 1 1 2
1 2 2 1
2 1 1 2
1 2 1 1
2 2 1 2
2 10 1 2
2 10 2 2
3
3
1
2
2
3
3
1
1
1
1
1
1
1
//但是 我的代码简单
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cstring>
#include <vector>
#include <math.h>
using namespace std; struct Node
{
int x;
int y;
} node;
vector<Node>v[];
int main()
{
int k,c;
int x2,y1,y2;
while()
{
scanf("%d",&k);
if(k==)break;
if(k==)
{
for(int i=; i<; ++i)
v[i].clear();
}
else if(k==)
{
scanf("%d%d%d",&node.x,&node.y,&c);
v[c].push_back(node);
}
else
{
int ans=;
scanf("%d%d%d",&x2,&y1,&y2);
for(int i=; i<=; ++i)
{
for(int j=; j<v[i].size(); ++j)
{
int xx=v[i][j].x;
int yy=v[i][j].y;
if(xx<=x2&&yy<=y2&&yy>=y1)
{
ans++;
break;
}
}
}
printf("%d\n",ans);
}
}
return ;
}
//欢迎喜欢算法 IT的dalao加1345411028 带我飞
2017ACM/ICPC广西邀请赛 Color it的更多相关文章
- 2017ACM/ICPC广西邀请赛-重现赛
HDU 6188 Duizi and Shunzi 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6188 思路: 签到题,以前写的. 实现代码: #inc ...
- 2017ACM/ICPC广西邀请赛-重现赛 1007.Duizi and Shunzi
Problem Description Nike likes playing cards and makes a problem of it. Now give you n integers, ai( ...
- 2017ACM/ICPC广西邀请赛-重现赛 1010.Query on A Tree
Problem Description Monkey A lives on a tree, he always plays on this tree. One day, monkey A learne ...
- 2017ACM/ICPC广西邀请赛-重现赛 1004.Covering
Problem Description Bob's school has a big playground, boys and girls always play games here after s ...
- HDU 6191 2017ACM/ICPC广西邀请赛 J Query on A Tree 可持久化01字典树+dfs序
题意 给一颗\(n\)个节点的带点权的树,以\(1\)为根节点,\(q\)次询问,每次询问给出2个数\(u\),\(x\),求\(u\)的子树中的点上的值与\(x\)异或的值最大为多少 分析 先dfs ...
- 2017ACM/ICPC广西邀请赛-重现赛 1001 A Math Problem
2017-08-31 16:48:00 writer:pprp 这个题比较容易,我用的是快速幂 写了一次就过了 题目如下: A Math Problem Time Limit: 2000/1000 M ...
- 2017ACM/ICPC广西邀请赛-重现赛1005 CS course
2017-08-31 16:19:30 writer:pprp 这道题快要卡死我了,队友已经告诉我思路了,但是做题速度很缓慢,很费力,想必是因为之前 的训练都是面向题解编程的缘故吧,以后不能这样了,另 ...
- 2017ACM/ICPC广西邀请赛
A.A Math Problem #include <bits/stdc++.h> using namespace std; typedef long long ll; inline ll ...
- 2017ACM/ICPC广西邀请赛 Duizi and Shunzi
题意:就是一个集合分开,有两种区分 对子:两个相同数字,顺子:连续三个不同数字,问最多分多少个 解法:贪心,如果当前数字不构成顺子就取对子 /2,如果可以取顺子,那么先取顺子再取对子 #include ...
随机推荐
- PWA-让前端网页媲美原生APP的用户体验
一.背景 从2018年到现在,作为号称下一代web应用模型的PWA,逐渐成为了一个各大前端厂商争先恐后进行涉足,布局的一个新的技术, 其主要的对标物Native app,作为现在最主流的mobile端 ...
- map test
// mapTest.cpp : Defines the entry point for the console application. // #include "stdafx.h&quo ...
- CSS进阶之路
下面主要引用http://www.cnblogs.com/wangfupeng1988/tag/css知多少/ CSS进阶笔记: 一.学习CSS的三个突破点 1.浏览器如何加载和解析CSS——CSS的 ...
- java 集合类 列表
Dissecting the Program Line 2-4 imports the collection framework classes and interfaces reside in th ...
- 什么是cdn?
CDN加速意思就是在用户和我们的服务器之间加一个缓存机制, 通过这个缓存机制动态获取IP地址根据地理位置,让用户到最近的服务器访问. 那么CDN是个啥? 全称Content Delivery Netw ...
- 洛谷 P1873 【砍树】
P1873 传送门 题外话 话说我们也要当一当光头强?? 大体题意 就是让你砍树,统一的高度,然后让你砍树,看看订什么高度合适. 思路: 二分答案,对高度二分,如果砍得树长度不够,那就说明高度高了. ...
- uniapp登录流程详解uni.login
uni.login(OBJECT)登录 H5平台登陆注意事项: 微信内嵌浏览器运行H5版时,可通过js sdk实现微信登陆,需要引入一个单独的js,详见普通浏览器上实现微信登陆,并非开放API,需要向 ...
- 【POJ3087】Shuffle'm Up
本题传送门 本题知识点:宽度优先搜索 模拟 + map 本题题意有点懵.就是单纯的把S1像例子那样插到S2里,根本不是什么宽搜题,因为只是一个方向就可以了.说是搜索题倒是有点意思,因为要查重. 不过c ...
- 利用iptables做端口转发
需求背景: A与C不在同一网段无法直接访问,而A和B,C和B可以互通.现需要A借助B访问C的3306端口. 解决方案: 利用iptables配置规则,实现端口转发. 具体操作: 在B上开启端口转发功能 ...
- python 操作es
Elasticsearch 是一个开源的搜索引擎,建立在一个全文搜索引擎库 Apache Lucene™ 基础之上. Lucene 可能是目前存在的,不论开源还是私有的,拥有最先进,高性能和全功能搜索 ...