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. [c/c++] programming之路(21)、字符串(二)

    一.for /l %i in (1,1,5) do calc 等命令行参数 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #inclu ...

  2. 使用MyBatis Generator 1.3.7自动生成代码

    MyBatis Generator是一款mybatis自动代码生成工具,可以通过配置后自动生成文件. MyBatis Generator有几种方法可以生成代码,下面是其中一种.  一.官网下载 MyB ...

  3. Go 接口(interface)

        文章转载地址:https://www.flysnow.org/2017/04/03/go-in-action-go-interface.html 1.什么是 interface? 简单的说,i ...

  4. sublime设置html在浏览器打开

    1.快捷键 Ctrl+Shift+P输入:pcip选择第一个 2.输入:View In Browser安装此插件 3.菜单栏Preferences->Key Bindings  输入:[{ &q ...

  5. 《Visual C# 从入门到精通》第二章方法和作用域——读书笔记

    第2章 方法和作用域 2.1创建方法 方法是一个基本的,强大的编程机制.可视为函数或者子程序相似的东西. 方法名是个有意义的标识符. 方法主体包含方法被调用时实际执行的语句. 声明一个方法的实例如下: ...

  6. 虹软SDK在nodejs中的集成

    ==虹软官网地址== http://www.arcsoft.com.cn 在官网注册账号,并且申请人脸识别激活码, 选择SDK版本和运行系统(windows/linux/android/ios) ,我 ...

  7. Android 虹软2.0人脸识别,注册失败问题 分析synchronized的作用

    人脸识别需要init初始化(FaceServer中),离开时需要unInit销毁:当一个含有人脸识别的界面A跳向另一个含有人脸识别的界面B时,由于初始化和销毁都是对FaceServer类加锁(sync ...

  8. 一段曾经处理datetime的代码

    前记:主要是数据库存储记录时一个属性是以"2019-01"这样的年月进行存储的,当需要根据A年月到B年月取出相关记录时,filter()直接range()是不行的,不是数值区间或者 ...

  9. android ------- 开发者的 RxJava 详解

    在正文开始之前的最后,放上 GitHub 链接和引入依赖的 gradle 代码: Github: https://github.com/ReactiveX/RxJava https://github. ...

  10. ml交叉验证

    https://blog.csdn.net/guanyuqiu/article/details/86006474 https://blog.csdn.net/weixin_42660173/artic ...