水题。

#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. 正确使用MySQL JDBC setFetchSize()方法解决JDBC处理大结果集 java.lang.OutOfMemoryError: Java heap space

    昨天在项目中需要对日志的查询结果进行导出功能. 日志导出功能的实现是这样的,输入查询条件,然后对查询结果进行导出.由于日志数据量比较大.多的时候,有上亿条记录. 之前的解决方案都是多次查询,然后使用l ...

  2. NSMutableDictionary 排序问题

    NSMutableDictionary 默认情况下是按字母的顺序进行排序的 (a-z)的默认排序如何自定义排序呢? 第一种,利用数组的sortedArrayUsingComparator调用 NSCo ...

  3. css-test

    transition-content See the Pen NLOgVR by nakata139@gmail.com (@deepblue1982) on CodePen.

  4. swfit:运算符重载 Operator Methods

    Operator Methods Classes and structures can provide their own implementations of existing operators. ...

  5. 2015 AlBaath Collegiate Programming Contest(2月14日训练赛)

    A (By ggg): 题意:一个人还有x秒到红绿灯,这个红绿灯有g秒绿灯,y秒黄 灯,r秒红灯,问你到红绿灯的时候是什么灯.值得注意的是绿 灯变黄灯时,第g秒是黄灯了. B (By Anxdada) ...

  6. QTreeWidgetItem封装

    #include "qtreewighthelper.h" QTreeWidgetItem* AddQTreeWidgetItemChild(QTreeWidgetItem* pa ...

  7. QT +菜单栏和工具栏

    #include "mainwindow.h" #include <QMenuBar>//菜单栏需要的头文件 #include <QMenu>//菜单 #i ...

  8. mosquitto linux部署

    1:官网下载 https://mosquitto.org/files/source/ 本文使用的是mosquitto-1.5.tar.gz 2:解压mosquitto-1.5.tar.gz tar - ...

  9. 第1节 flume:4、离线项目处理的整个架构图;5、flume的基本介绍;

    第1节 flume:4.离线项目处理的整个架构图 辅助系统工具:flume,azkaban,sqoop. 在一个完整的离线大数据处理系统中,除了hdfs+mapreduce+hive组成分析系统的核心 ...

  10. java 定时任务-servlet

    在web.xml中配置监听类. <listener> <listener-class>com.skin.generate.action.TaskManager</list ...