水题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; struct X
{
int x,y;
}s[],tmp[]; int n; int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%d%d",&s[i].x,&s[i].y); int flag=-;
for(int i=;i<=n;i++)
{
for(int j=;j<=n;j++)
{
if(s[i].x!=s[j].x&&s[i].y!=s[j].y)
{
flag=;
tmp[]=s[i];
tmp[]=s[j];
tmp[].x=s[i].x; tmp[].y=s[j].y;
tmp[].x=s[j].x; tmp[].y=s[i].y;
break;
}
}
if(flag==) break;
}
if(flag==-) printf("-1\n");
else
{
flag=;
for(int i=;i<=n;i++)
{
bool f=;
for(int j=;j<=;j++)
{
if(s[i].x==tmp[j].x&&s[i].y==tmp[j].y) f=;
}
if(f==) flag=-;
}
if(flag==-) printf("-1\n");
else{
printf("%d\n",abs(tmp[].x-tmp[].x)*abs(tmp[].y-tmp[].y));
}
} return ;
}

CodeForces 596A Wilbur and Swimming Pool的更多相关文章

  1. Codeforces Round #331 (Div. 2) A. Wilbur and Swimming Pool 水题

    A. Wilbur and Swimming Pool Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...

  2. Codeforces Round #331 (Div. 2) _A. Wilbur and Swimming Pool

    A. Wilbur and Swimming Pool time limit per test 1 second memory limit per test 256 megabytes input s ...

  3. Codeforce#331 (Div. 2) A. Wilbur and Swimming Pool(谨以此题来纪念我的愚蠢)

    C time limit per test 1 second memory limit per test 256 megabytes input standard input output stand ...

  4. Codeforces--596A--Wilbur and Swimming Pool(数学)

     A - Wilbur and Swimming Pool Crawling in process... Crawling failed Time Limit:1000MS     Memory ...

  5. 【CodeForces 596A】E - 特别水的题5-Wilbur and Swimming Pool

    Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the ...

  6. CodeForces 596A

    Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the ...

  7. Codeforces 596D Wilbur and Trees

    http://codeforces.com/contest/596/problem/D 题目大意: 有n棵树排成一排,高度都为h. 主人公要去砍树,每次等概率地随机选择没倒的树中最左边的树或者最右边的 ...

  8. Codeforces 596D Wilbur and Trees dp (看题解)

    一直在考虑, 每一段的贡献, 没想到这个东西能直接dp..因为所有的h都是一样的. #include<bits/stdc++.h> #define LL long long #define ...

  9. codeforces 596E Wilbur and Strings

    题意:一个矩阵上面有0~9的数字,可以从任意一个格子出发,每次根据格子上的数字会前进到另一个格子(或原地不动),现在给出q个数位串,问是否有走法可以取出这个串(走到格子上的时候可以不取). 思路:发现 ...

随机推荐

  1. NSValue的个人想法

    通过下面的代码,又可以将NSValue转换成CGRect,CGPoint等类型的数值. CGRect imageRect = [[self.lockImageRectArray objectAtInd ...

  2. mac homebrew安装

    http://book.51cto.com/art/201107/278761.htm 3.2.3 使用 Homebrew 安装 Git Mac OS X 有好几个包管理器,用于管理一些开源软件在 M ...

  3. About the iOS File System

    两个维度: 1)是否给用户使用: 2)是否持久存储. During installation of a new app, the installer creates a number of conta ...

  4. postman的关联,即如何在请求中引用上次请求返回的值

    做接口测试,一定会遇到这种情况,需要拿上次请求的值在本次请求中使用,比如,我们去测试一个东西,要去登录才能做其他的操作,需要拿到登录返回数据中的某些字段,比如,token啊等... 如果发一次请求,就 ...

  5. 部署 k8s Cluster(下)【转】

    上节我们通过 kubeadm 在 k8s-master 上部署了 Kubernetes,本节安装 Pod 网络并添加 k8s-node1 和 k8s-node2,完成集群部署. 安装 Pod 网络 要 ...

  6. Window服务程序(windows service application)如何调试

    服务程序不能通过常规的按F5或F11的方式来进行调试和运行,也无法立即运行一个服务或逐步调试它的代码. 因此,你必须安装并启动你的服务,然后附属(attach)一个Debugger到这个服务的进程上.

  7. bonding的系统初始化介绍

    bond0模块的加载 Bonding原理 为方便理解bonding的配置及实现,顺便阐述一下Linux的网络接口及其配置文件.在 Linux 中,所有的网络通讯都发生在软件接口与物理网络设备之间.与网 ...

  8. java内存模型(线程共享部分)

    1.元空间(MetaSpace)与永久代(PermGen)的区别? ----> 1.1 元空间使用的是本机内存(这样的好处是,可以使用的内存空间变大了,没有OutOfMemoryError:Pe ...

  9. PyTorch的十七个损失函数

    本文截取自<PyTorch 模型训练实用教程>,获取全文pdf请点击: tensor-yu/PyTorch_Tutorial​github.com 版权声明:本文为博主原创文章,转载请附上 ...

  10. 字典(trie)树--从入门到入土

    今天再来认识一个强大的数据结构. 字典树又称单词查找树,Trie树,是一种树形结构,是一种哈希树的变种.典型应用是用于统计,排序和保存大量的字符串(但不仅限于字符串),所以经常被搜索引擎系统用于文本词 ...