1628

题意不太好理解 求横黑条 和竖黑条共有多少个 注意1*1的情况 如果横向纵向都是1*1 算为一个 否则不算

用了下vector  枚举找下

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
using namespace std;
#define N 30010
vector<int>p[N];
vector<int>q[N];
int o1[N],o2[N];
int main()
{
int i,j,m,n,k,x,y,t,sum=;
scanf("%d%d%d",&m,&n,&k);
for(i = ; i <= k ;i++)
{
scanf("%d%d",&x,&y);
p[x].push_back(y);
q[y].push_back(x);
}
for(i = ; i <= m ; i++)
p[i].push_back(n+);
for(i = ; i <= n ; i++)
q[i].push_back(m+);
for(i = ; i <= m ; i++)
{
t = ;
sort(p[i].begin(),p[i].end());
for(j = ; j < (int)p[i].size() ; j++)
{
if(p[i][j]-t>)
sum+=;
t = p[i][j];
}
}
for(i = ; i <= n ; i++)
{
sort(q[i].begin(),q[i].end());
t = ;
for(j = ; j < (int)q[i].size() ; j++)
{
if(q[i][j]-t>)
sum+=;
else if(q[i][j]-t>)
{
int ot = q[i][j]-;
t = ;
for(int g = ; g < (int)p[ot].size() ; g++)
{
if(p[ot][g]>i)
{
if(p[ot][g]-t<=)
sum+=;
break;
}
t = p[ot][g];
}
}
t = q[i][j];
}
}
printf("%d\n",sum);
return ;
}

1628. White Streaks(STL)的更多相关文章

  1. ural1628 White Streaks

    White Streaks Time limit: 1.0 secondMemory limit: 64 MB The life of every unlucky person has not onl ...

  2. stl文件格式

    http://wenku.baidu.com/view/a3ab7a26ee06eff9aef8077b.html [每个三角形面片的定义包括三角形各个定点的三维坐标及三角形面片的法矢量[三角形的法线 ...

  3. 【暴力,STL,水】UVa 1523 - Helicopter

    Since ancient time, people have been dreaming of flying in the sky. Eventually, the dream was realiz ...

  4. Codeforces 260D - Black and White Tree

    260D - Black and White Tree 思路:把两种颜色先按值sort一下,最小值肯定是叶子,然后把这个叶子和另外一中颜色的一个最小值的节点连接起来,再把这个节点变成叶子,把值减掉就可 ...

  5. D - Association for Control Over Minds Kattis - control (并查集+STL)

    You are the boss of ACM (Association for Control over Minds), an upstanding company with a single go ...

  6. 详细解说 STL 排序(Sort)

    0 前言: STL,为什么你必须掌握 对于程序员来说,数据结构是必修的一门课.从查找到排序,从链表到二叉树,几乎所有的算法和原理都需要理解,理解不了也要死记硬背下来.幸运的是这些理论都已经比较成熟,算 ...

  7. STL标准模板库(简介)

    标准模板库(STL,Standard Template Library)是C++标准库的重要组成部分,包含了诸多在计算机科学领域里所常见的基本数据结构和基本算法,为广大C++程序员提供了一个可扩展的应 ...

  8. STL的std::find和std::find_if

    std::find是用来查找容器元素算法,但是它只能查找容器元素为基本数据类型,如果想要查找类类型,应该使用find_if. 小例子: #include "stdafx.h" #i ...

  9. STL: unordered_map 自定义键值使用

    使用Windows下 RECT 类型做unordered_map 键值 1. Hash 函数 计算自定义类型的hash值. struct hash_RECT { size_t operator()(c ...

随机推荐

  1. thymeleaf 模板布局

    八.模板布局(Template Layout) 8.1 包含模板片段(Including template fragments) 定义和引用片段 我们通常想要从别的模板文件中调用一些模板片段,例如 页 ...

  2. MSP430F4152串口操作

    /**********************************************************************/  /*  名称:串口通讯 功能:将接到的数据组后原封不 ...

  3. exec php

    $m = memory_get_usage(); echo $m; require_once('include/entryPoint.php'); // for ($i=0; $i < 5000 ...

  4. Nginx upstream的5种权重分配方式

    .轮询(默认) 每个请求按时间顺序逐一分配到不同的后端服务器,后端服务器down掉,能自动剔除 .weight 指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况. upstre ...

  5. IIS7 无法访问请求的页面,因为该页的相关配置数据无效

    HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 解决方案: C:\Windows\Microsoft.NET\Frame ...

  6. 微软职位内部推荐-Principal Architect for Windows Security

    微软近期Open的职位: Location: China, BeijingDivision: Operations System Group Engineering Group OverviewOSG ...

  7. DataTableExtensions.AsEnumerable 方法

    在下面的示例中,DisplayProducts 方法接收一个数据表,其中包含名为 ProductName一个 DataColumn,提取 ProductName 值,然后输出值. using Syst ...

  8. C#的历史及IDE总结

         原Borland公司的首席研发设计师安德斯·海爾斯伯格(Anders Hejlsberg)在微軟開發了Visual J++ 1.0,很快的Visual J++由1.1版本升級到6.0版.SU ...

  9. dtGrid插件集成到Angular环境实现表格化数据展现

    00没有抱怨的世界 周末效率好低,两天没更了,看看这看看那,装了个win10发现触摸板驱动不适配,然后找了好久都不行,23333. AngularJS用的时间很短,高级的用法有点吃不消了,$diges ...

  10. 1061: [Noi2008]志愿者招募 - BZOJ

    Description 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管.布布刚上任就遇到了一个难题:为即将启动的奥运新项目招募一批短期志愿者.经过估算,这个项目需要N 天才能完 ...