CodeForces 596A Wilbur and Swimming Pool
水题。
#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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- Codeforces--596A--Wilbur and Swimming Pool(数学)
A - Wilbur and Swimming Pool Crawling in process... Crawling failed Time Limit:1000MS Memory ...
- 【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 ...
- CodeForces 596A
Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the ...
- Codeforces 596D Wilbur and Trees
http://codeforces.com/contest/596/problem/D 题目大意: 有n棵树排成一排,高度都为h. 主人公要去砍树,每次等概率地随机选择没倒的树中最左边的树或者最右边的 ...
- Codeforces 596D Wilbur and Trees dp (看题解)
一直在考虑, 每一段的贡献, 没想到这个东西能直接dp..因为所有的h都是一样的. #include<bits/stdc++.h> #define LL long long #define ...
- codeforces 596E Wilbur and Strings
题意:一个矩阵上面有0~9的数字,可以从任意一个格子出发,每次根据格子上的数字会前进到另一个格子(或原地不动),现在给出q个数位串,问是否有走法可以取出这个串(走到格子上的时候可以不取). 思路:发现 ...
随机推荐
- SSAS 系列01- DAX公式常用公式
计算第一次购买时间 CALCULATE(FIRSTDATE(FactInternetSales[OrderDate]),ALLEXCEPT(FactInternetSales,FactInternet ...
- GPU、CPU的异同
一.概念 CPU(Center Processing Unit)即中央处理器,GPU(Graphics Processing Unit)即图形处理器. 二.CPU和GPU的相同之处 两者都有总线和外界 ...
- 阿里云服务器ECS部署应用教程
购买阿里云服务器 大多数云服务器默认安装的语言运行环境版本都很旧了,python用的还是2.7,JDK用的还是1.6的,在ECS云服务器中可以自行安装,包括python3.4之类的. 在次页面购买EC ...
- SQLite -语法
SQLite -语法 SQLite是紧随其后的是独特的组称为语法的规则和指导方针.本教程为您提供了快速启动和SQLite的清单的所有基本SQLite语法. 大小写敏感性 注意重要的一点是,SQLite ...
- android打包需要的图标
ldpi:mdpi:hdpi:xhdpi:xxhdpi=3:4:6:8:12 大小: 32x32.png 48 72 96 144
- 【2019.6.2】python:json操作、函数、集合、random()等
一.json操作: json就是一个字符串,从文件中读取json,必须是json格式.j'son串中必须是双引号,不能有单引号,单引号不能转换 1.1使用: import json #使用json先引 ...
- Java开发中常见的异常问题
要调试程序,自然需要对程序中的常见的异常有一定的了解,因此在这里我将一些常见的Java程序中的异常列举出来给大家参考 AD: 作为一名开发者,Java程序员,很自然必须熟悉对程序的调试方法.而要调试程 ...
- jQuery闪烁提示,让新消息在网页标题显示
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head& ...
- mysql优化之参数优化(转)
1.优化方式 硬件优化=>系统优化=>mysql配置优化=>SCHEMA优化=>sql优化=>其他解决方案(redis or MongoDB or Cassandra o ...
- Django之学员管理二
Django之学员管理二 学生表的一对多的增删改查 views.py def students(request): #select students.sid,students.name,classes ...