10411: F.Distribution

Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 11  Solved: 8 [Submit][Status][Web Board]

Description

One day , Wang and Dong in the Dubai desert expedition, discovered an ancient castle. Fortunately, they found a map of the castle.The map marks the location of treasures.

They agreed to distribute the treasures according to the following rules:

Wang draws a horizontal line on the map and then Dong draws a vertical one so that the map is divided into 4 parts, as show below.

II                              I

III                             IV

Wang will save the treasures in I and III ,while those situated in II and IV will be taken away by Dong. Wang first draw a horizontal line, Dong after the draw a vertical line.

They drew several pairs of  lines. For each pair, Wang wants to know the difference between their treasures.

It's guaranteed that all the reasures will lie on neither of the lines drew by them.

Input

One day , Wang and Dong in the Dubai desert expedition, discovered an ancient castle. Fortunately, they found a map of the castle.The map marks the location of treasures.

They agreed to distribute the treasures according to the following rules:

Wang draws a horizontal line on the map and then Dong draws a vertical one so that the map is divided into 4 parts, as show below.

II                              I

III                             IV

Wang will save the treasures in I and III ,while those situated in II and IV will be taken away by Dong. Wang first draw a horizontal line, Dong after the draw a vertical line.

They drew several pairs of  lines. For each pair, Wang wants to know the difference between their treasures.

It's guaranteed that all the reasures will lie on neither of the lines drew by them.

Output

Output  contains   lines , a single line with a integer , the difference described above.

Sample Input

10 3
29 22
17 14
18 23
3 15
6 28
30 27
4 1
26 7
8 0
11 21
2 25
5 10
19 24

Sample Output

-6
4
4

HINT

 

Source

第八届河南省赛

题解:题目乱码了,意思是给你一些点,然后两条线,分割这些点,一个人要13区域的,一个人要24区域的,让求两个人得到的点数的差

输入:两个数N,M,代表N个点,M代表x,y的值;

代码:

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
#define SI(x) scanf("%d",&x)
#define mem(x,y) memset(x,y,sizeof(x))
#define PI(x) printf("%d",x)
#define P_ printf(" ")
const int INF=0x3f3f3f3f;
typedef long long LL;
const int MAXN=100010;
struct Node{
int x,y;
Node init(){
scanf("%d%d",&x,&y);
}
};
Node dt[MAXN];
int main(){
int N,M,x,y;
while(~scanf("%d%d",&N,&M)){
for(int i=0;i<N;i++){
dt[i].init();
}
for(int i=0;i<M;i++){
SI(x);SI(y);
int t1=0,t2=0;
for(int j=0;j<N;j++){
if((dt[j].x>x&&dt[j].y>y)||(dt[j].x<x&&dt[j].y<y))t1++;
}
printf("%d\n",2*t1-N);
}
}
return 0;
}

  

第八届河南省赛F.Distribution(水题)的更多相关文章

  1. 第八届河南省赛B.最大岛屿(dfs)

    B.最大岛屿 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 30  Solved: 18 [Submit][Status][Web Board] De ...

  2. 第八届河南省赛G.Interference Signal(dp)

    G.Interference Signal Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 35  Solved: 17 [Submit][Status ...

  3. 第八届河南省赛D.引水工程(kruthcra+prime)

    D.引水工程 Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 118  Solved: 41 [Submit][Status][Web Board] D ...

  4. 第八届河南省赛C.最少换乘(最短路建图)

    C.最少换乘 Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 94  Solved: 25 [Submit][Status][Web Board] De ...

  5. POJ-2421Constructing Roads,又是最小生成树,和第八届河南省赛的引水工程惊人的相似,并查集与最小生成树的灵活与能用,水过~~~

    Constructing Roads Time Limit: 2000MS   Memory Limit: 65536K               Description There are N v ...

  6. 第七届河南省赛F.Turing equation(模拟)

    10399: F.Turing equation Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 151  Solved: 84 [Submit][St ...

  7. ZOJ 17届校赛 Knuth-Morris-Pratt Algorithm( 水题)

    In computer science, the Knuth-Morris-Pratt string searching algorithm (or KMP algorithm) searches f ...

  8. HDU 4730 We Love MOE Girls (2013成都网络赛,签到水题)

    We Love MOE Girls Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. hdu 5038 (2014北京网络赛G 排序水题)

    题意:有n个数字,带入10000 - (100 - ai) ^ 2公式得到n个数,输出n个数中频率最大的数,如果有并列就按值从小到大都输出输出,如果频率相同的数字是全部的n个数,就输出Bad....题 ...

随机推荐

  1. Scala的类中定义内部类实战

    scala独特之处在于可以在类中定义内部类,起到对外屏蔽作用. 类中默认都是public权限.后面将讲解如何引入接口,scala中的接口与java点区别.特质/接口(Trait)

  2. 编程工具篇——Vim

    配置 配置文件位于:/etc/vim/vimrc(添加配置在文件末尾输入代码即可) 常用配置 配色方案 :colorscheme ron(其中ron为我的配色方案,也可以选择其他,软件中自带配色文件全 ...

  3. Linux 二进制包安装MySQL的一些问题

    第一步:安装相关的依赖yum install perl-Data-Dumper 第二步:初始化mysql数据库的内部信息./scripts/mysql_install_db --basedir=/us ...

  4. android 环境搭建 windows, linux

    android环境也搭建了很多次了,linux下window下.在这里记录下,以后再搭建设置变量啥的就直接看自己的博客就好了.电子挡笔记有时候也不方便 1.下载材料 概述:用的是比较简单的方式搭建环境 ...

  5. swift3.0 构造器、析构方法(3)

    构造和析构是两种特殊的方法,在对象进行初始化的时候 使用构造,在对象的释放操作中,使用析构. 构造器的定义: init (){ //代码 } init(name:String){ //代码 } 在构造 ...

  6. 通过iframe在其父窗口中打开隐藏元素

    先上代码 $(".login-box,#dl,.top_01 a:eq(1)").click(function(){ if(self!=top){ parent.$("# ...

  7. 游戏开场镜头拉近(Unity3D开发之四)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/? p=553 今天看了个Demo.发现 ...

  8. Windows消息大全

    最近在写TabControl的用户控件,需要用到sendMessage,已做备份. 引用:http://bbs.aau.cn/forum.php?mod=viewthread&tid=7776 ...

  9. JavaScrtip之JS最佳实践

    一.JavaScript之平稳退化 这边使用一个当用户点击某个页面内某个链接弹出一个新窗口的案例: JavaScript使用window对象的open()方法来创建新的浏览器窗口; window.op ...

  10. Table显示边框

    style="border-bottom: 1px solid #CCCCCC;"