pro:给定规则的多边形,规则是指顶点都在整点上,而且是相互垂直的边的交点。 现在给定两个多边形A,B,问A,B缩小,旋转后是否可以变为同一个图形。

sol:缩小的话,直接离散化即可,就可以去掉没用的部分,旋转的话,可以手动旋转4次。

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int maxn=;
struct in{
int N,a[maxn],b[maxn],x[maxn],y[maxn];
int lx,ly;
void init()
{
scanf("%d",&N);
rep(i,,N) scanf("%d%d",&a[i],&b[i]);
rep(i,,N) x[i]=a[i],y[i]=b[i];
sort(x+,x+N+); sort(y+,y+N+);
lx=unique(x+,x+N+)-(x+);
rep(i,,N) a[i]=lower_bound(x+,x+lx+,a[i])-x;
ly=unique(y+,y+N+)-(y+);
rep(i,,N) b[i]=lower_bound(y+,y+ly+,b[i])-y;
}
void turn()
{
rep(i,,N){
int t=a[i],q=b[i];
a[i]=q; b[i]=-t+lx+;
}
swap(lx,ly);
}
}A,B;
bool equel()
{
int pos=;
rep(i,,A.N){
if(A.a[i]==B.a[]&&A.b[i]==B.b[]){
pos=i; break;
}
}
if(!pos) return false;
rep(i,pos,A.N)
if(A.a[i]!=B.a[i+-pos]||A.b[i]!=B.b[i+-pos])
return false;
rep(i,,pos-)
if(A.a[i]!=B.a[A.N-pos+i+]||A.b[i]!=B.b[A.N-pos+i+])
return false;
return true;
}
int main()
{
A.init();
B.init();
if(A.N!=B.N) return puts("no"),;
rep(i,,){
if(equel()) return puts("yes"),;
A.turn();
}
puts("no");
return ;
}

Gym - 100783G:Playing With Geometry (几何 离散化 )的更多相关文章

  1. Codeforces Round #361 (Div. 2) E. Mike and Geometry Problem 离散化 排列组合

    E. Mike and Geometry Problem 题目连接: http://www.codeforces.com/contest/689/problem/E Description Mike ...

  2. PostGIS解析Geometry几何对象

    一.Geometry转WKT select st_astext(geom) where tableName; 二.PostGIS常用函数 wkt转geometry st_geomfromtext(wk ...

  3. Codeforces Round #361 (Div. 2) E. Mike and Geometry Problem 离散化+逆元

    E. Mike and Geometry Problem time limit per test 3 seconds memory limit per test 256 megabytes input ...

  4. PyQt(Python+Qt)学习随笔:Qt Designer中部件的geometry几何属性

    geometry属性保存部件相对于其父级对象的位置和大小,Qt实际上是以一个长方形来表示部件的位置和大小的,包括左上角的坐标位置.长度和宽带. 当部件的geometry调整时,部件如果可见将立即接收m ...

  5. gym 101081 E. Polish Fortress 几何

    E. Polish Fortress time limit per test 2.0 s memory limit per test 256 MB input standard input outpu ...

  6. Gym 100531J Joy of Flight (几何)

    题意:你从开始坐标到末尾坐标,要经过 k 秒,然后给你每秒的风向,和飞机的最大速度,问能不能从开始到末尾. 析:首先这个风向是不确定的,所以我们先排除风向的影响,然后算出,静风是的最小速度,如果这都大 ...

  7. JTS(Geometry)(转)

    原文链接:http://blog.csdn.net/cdl2008sky/article/details/7268577 空间数据模型(1).JTS Geometry model (2).ISO Ge ...

  8. PostGIS 操作geometry方法

    WKT定义几何对象格式: POINT(0 0) ——点 LINESTRING(0 0,1 1,1 2) ——线 POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2 ...

  9. Northwestern European Regional Contest 2014 Gym - 101482

    Gym 101482C Cent Savings 简单的dp #include<bits/stdc++.h> #define inf 0x3f3f3f3f #define inf64 0x ...

随机推荐

  1. [译]Quartz.NET 3.x 教程

    译者注: 最近有点小浮躁,找点事做做平静下内心的焦作,干脆翻译下 Quartz.NET 3.x Tutorial 好了. Quartz.NET 3.x 教程 选择课程:带划线的表示没完成 课程 1: ...

  2. Intellij IDEA 设置启动JVM参数

    目录 采用CMS垃圾回收配置: 采用G1垃圾回收配置: 参数说明: 通用参数: CMS机制才有的参数: G1机制才有的参数: 参考: 打开 IDEA 安装目录,看到有一个 bin 目录,其中有两个 v ...

  3. Python入门 函数式编程

    高阶函数 map/reduce from functools import reduce def fn(x, y): return x * 10 + y def char2num(s): digits ...

  4. 微信小程序wepy开发,属性绑定的事件参数中可以使用{{}}写实参

    <view wx:for="{{tablist}}" class="item {{activeid === item.id ? 'active':''}}" ...

  5. U3D外包公司:Ruby的未来

    那是一段醉人的日子.元素数据编程,动态类型,Ruby和Rails组合而带来的约定优于配置(Convention Over Configuration)的模式,给了我们更加快速的开发和更简洁的代码.已经 ...

  6. ubuntun 18.04 安装和配置mysql数据库

    一:更新镜像源 sudo apt-get update 二:下载数据库 sudo apt-get install mysql-server-5.7 sudo apt-get install mysql ...

  7. nodejs点滴

    1.exports与module.exports http://cnodejs.org/topic/5231a630101e574521e45ef8 因为require指向了module.export ...

  8. CentOS7下mariadb日常管理

    在CentOS7下,官方提供的mysql的rpm包就是mariadb,可查看mariadb包信息 [root@host ~]$rpm -qi mariadb # 需要先安装该包 Name : mari ...

  9. 『流畅的Python』第5章笔记_一等函数

  10. 『Python』源码解析_从ctype模块理解对象

    1.对象的引用计数 从c代码分析可知,python所有对象的内存有着同样的起始结构:引用计数+类型信息,实际上这些信息在python本体重也是可以透过包来一窥一二的, from ctypes impo ...