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. PHP中刷新输出缓冲,立即输出数据

    <script type="text/javascript"> function show_message(message) { document.getElement ...

  2. javascript的setTimeout以及setInterval休眠问题。

    前端码农们在做项目中时候,必定不可少的需要做到轮播效果.但是有些特殊的需求,比如: 需要做到第一个容器内容轮播滚动之后,第二个容器内部再轮播滚动,再第三个容器内容轮播滚动. 这时候我的一开始的思路是: ...

  3. delphi调用 java 的 WebService服务端.

    // InvRegistry.RegisterInvokeOptions(TypeInfo(ModelADServicePortType), ioLiteral); InvRegistry.Regis ...

  4. Foreign Exchange

     10763 Foreign ExchangeYour non-profit organization (iCORE - international Confederation of Revolver ...

  5. asp 回发的时候样式变化

    在一个按钮确定后弹出一个提示框,在提示框没有关闭时有时会发现页面的样式发生变化. 解决方法: 在DIV外增加,<table><tr><td align="lef ...

  6. "!x++" 我之见解

    "!x++"之说,各人见解不同,但真理只有一个.我只尝试着说出一种见解,未知真相. 何如? "!x++"等价于"!(x++)". 理论分析 ...

  7. Create a SharePoint Application Page for Anonymous Access

    http://dishasharepointworld.blogspot.com/2011/07/how-to-create-sharepoint-application_1072.html http ...

  8. iOS的view翻转动画实现--代码老,供参考

    新建一个view-based模板工程,在ViewController文件中添加下面的代码,即可实现翻转效果: - (void)viewDidLoad { [super viewDidLoad]; // ...

  9. AirDrop显示名字的修改问题

    AirDrop的名字来源是设备登陆的iCloud账户 打开iCloud设置 把个人信息的名字改成自己的即可 前提是你的账号没有借朋友用过,如果朋友用过恰好没注销,你的通讯录又有你的朋友的号码,很有可能 ...

  10. springMVC+MyBatis+Spring 整合(2)

    mybatis 与Spring 的整合. 1.导入Spring 和Springmvc的包 pom <project xmlns="http://maven.apache.org/POM ...