[杂题] Codeforces Gym 101190 NEERC 16 K. Kids Designing Kids
来源:互联网 发布:淘宝卖家后台网址 编辑:程序博客网 时间:2024/05/22 11:59
其实就是三个图异或起来为空
要的就是个观察
after moving the figures, some two of these three freckles must be in the same point.
There are only three possible shifts, check them all
#include<cstdio>#include<cstdlib>#include<algorithm>#include<set>#define X first#define Y secondusing namespace std;typedef pair<int,int> abcd;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;}inline void read(int &x){ char c=nc(),b=1; for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1; for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;}inline void read(char *s){ char c=nc(); int len=0; for (;!(c=='.' || c=='*');c=nc()); for (;c=='.' || c=='*';s[++len]=c,c=nc());}abcd Ad,Bd,Cd;set<abcd> A,B,C,T,S;abcd operator + (const abcd &A,const abcd &B){ return abcd(A.X+B.X,A.Y+B.Y);}inline void Read(set<abcd> &A,abcd &Ad){ static int n,m; static char s[1005]; read(n); read(m); int f=0; for (int i=1;i<=n;i++){ read(s); for (int j=1;j<=m;j++) if (s[j]=='*'){ if (!f) Ad=abcd(-i,-j),f=1; A.insert(abcd(i,j)+Ad); } }}inline bool Pd(set<abcd> &A,abcd &Ad,set<abcd> &B,abcd &Bd,set<abcd> &C,abcd &Cd){ T.clear(); for (abcd i:A) T.insert(i); for (abcd i:B) if (T.count(i)) T.erase(i); else T.insert(i); abcd t=*T.begin(); if (C.size()!=T.size()) return 0; for (abcd i:C) if (!T.count(i+t)) return 0; Cd=Cd+t; return 1;}int main(){ freopen("kids.in","r",stdin); freopen("kids.out","w",stdout); Read(A,Ad); Read(B,Bd); Read(C,Cd); if (Pd(A,Ad,B,Bd,C,Cd) || Pd(A,Ad,C,Cd,B,Bd) || Pd(B,Bd,C,Cd,A,Ad)) printf("YES\n%d %d",Bd.Y-Ad.Y,Bd.X-Ad.X); else printf("NO\n"); return 0;}
0 0
- [杂题] Codeforces Gym 101190 NEERC 16 K. Kids Designing Kids
- [可图性判定 Havel-Hakimi定理 构造] Codeforces Gym 100269 NEERC 13 Northern K. Kids in a Friendly Class
- codeforces Gym 100269K——Kids in a Friendly Class(可图性判定)
- [构造][度数序列的可图性]Codeforces Gym 100269K. Kids in a Friendly Class
- [物理 杂题] Codeforces Gym 101190 NEERC 16 J. Jenga Boom
- [杂题] Codeforces Gym 101190 NEERC 16 L. List of Primes
- [博弈论] Codeforces Gym 101190 NEERC 16 G. Game on Graph
- [构造] Codeforces Gym 101190 NEERC 16 C. Cactus Construction
- [扫描线 杂题] Codeforces Gym 101190 NEERC 16 E. Expect to Wait
- [杂题 交互] Codeforces Gym 101190 NEERC 16 I. Indiana Jones and the Uniform Cave
- Codeforces Gym 101190 (NEERC 2016) A. Abbreviation
- Crazy Kids
- Kids' Wishes
- Kids’ Riddle
- [树形DP 费用流手动增广] Codeforces Gym 101190 NEERC 16 M. Mole Tunnels
- [Trie树建图 2-SAT] Codeforces Gym 101190 NEERC 16 B. Binary Code
- [费用流建模] Codeforces Gym 101190 NEERC 16 D. Delight for a Cat
- Codeforces Gym 101190 (NEERC 2016) F. Foreign Postcards (dp + 期望)
- 170411 VJ题解(3)(ZOJ
- 2787 加密术
- qt中获取打开文件路径,颜色对话框,字体对话框,自定义对话框,消息对话框,输入对话框
- UVa 815 Flooding!(排序)
- How to use Pip and PyPI
- [杂题] Codeforces Gym 101190 NEERC 16 K. Kids Designing Kids
- 动态规划练习一 23:大盗阿福
- win10 x64, python3.6+opencv 3.2
- [sdoi2017][bzoj4821] D2T3 相关分析
- 循环语法注意点
- Javascript面向对象(二)——setter、getter属性
- unix系统之acct()
- Android 客户端Socket 实现及简单封装。
- nyoj-部分和问题