CROC 2016 - Elimination Round (Rated Unofficial Edition) A. Amity Assessment 水题

时间:2022-08-29 16:04:33

A. Amity Assessment

题目连接:

http://www.codeforces.com/contest/655/problem/A

Description

Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid cell empty. To make a move, Bessie or Elsie can slide a tile adjacent to the empty cell into the empty cell as shown below:

In order to determine if they are truly Best Friends For Life (BFFLs), Bessie and Elsie would like to know if there exists a sequence of moves that takes their puzzles to the same configuration (moves can be performed in both puzzles). Two puzzles are considered to be in the same configuration if each tile is on top of the same grid cell in both puzzles. Since the tiles are labeled with letters, rotations and reflections are not allowed.

Input

The first two lines of the input consist of a 2 × 2 grid describing the initial configuration of Bessie's puzzle. The next two lines contain a 2 × 2 grid describing the initial configuration of Elsie's puzzle. The positions of the tiles are labeled 'A', 'B', and 'C', while the empty cell is labeled 'X'. It's guaranteed that both puzzles contain exactly one tile with each letter and exactly one empty position.

Output

Output "YES"(without quotes) if the puzzles can reach the same configuration (and Bessie and Elsie are truly BFFLs). Otherwise, print "NO" (without quotes).

Sample Input

AB

XC

XB

AC

Sample Output

YES

Hint

题意

类似于华容道一样,一个2*2的格子,然后问你能不能从第一个推到第二个

题解:

由于是2*2的,我们比较简单的就可以发现,其实他按照顺时针\逆时针的顺序是不会改变的。

所以只用check一下顺序就好了。

代码

#include<bits/stdc++.h>
using namespace std; string s1,s2; int main()
{
string a,b,c,d;
cin>>a>>b>>c>>d;
for(int i=0;i<2;i++)
if(a[i]!='X')s1+=a[i];
for(int i=1;i>=0;i--)
if(b[i]!='X')s1+=b[i];
for(int i=0;i<2;i++)
if(c[i]!='X')s2+=c[i];
for(int i=1;i>=0;i--)
if(d[i]!='X')s2+=d[i];
s1+=s1;
if(s1.find(s2)!=string::npos)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}

CROC 2016 - Elimination Round (Rated Unofficial Edition) A. Amity Assessment 水题的更多相关文章

  1. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; D&period; Robot Rapping Results Report 二分&plus;拓扑排序

    D. Robot Rapping Results Report 题目连接: http://www.codeforces.com/contest/655/problem/D Description Wh ...

  2. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; D&period; Robot Rapping Results Report 拓扑排序&plus;二分

    题目链接: http://www.codeforces.com/contest/655/problem/D 题意: 题目是要求前k个场次就能确定唯一的拓扑序,求满足条件的最小k. 题解: 二分k的取值 ...

  3. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; F - Cowslip Collections 数论 &plus; 容斥

    F - Cowslip Collections http://codeforces.com/blog/entry/43868 这个题解讲的很好... #include<bits/stdc++.h ...

  4. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; E - Intellectual Inquiry dp

    E - Intellectual Inquiry 思路:我自己YY了一个算本质不同子序列的方法, 发现和网上都不一样. 我们从每个点出发向其后面第一个a, b, c, d ...连一条边,那么总的不同 ...

  5. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; E&period; Intellectual Inquiry 贪心 构造 dp

    E. Intellectual Inquiry 题目连接: http://www.codeforces.com/contest/655/problem/E Description After gett ...

  6. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; C&period; Enduring Exodus 二分

    C. Enduring Exodus 题目连接: http://www.codeforces.com/contest/655/problem/C Description In an attempt t ...

  7. CROC 2016 - Elimination Round &lpar;Rated Unofficial Edition&rpar; B&period; Mischievous Mess Makers 贪心

    B. Mischievous Mess Makers 题目连接: http://www.codeforces.com/contest/655/problem/B Description It is a ...

  8. 8VC Venture Cup 2016 - Final Round &lpar;Div&period; 2 Edition&rpar;B&period; sland Puzzle 水题

    B. sland Puzzle 题目连接: http://www.codeforces.com/contest/635/problem/B Description A remote island ch ...

  9. CF &num;CROC 2016 - Elimination Round D&period; Robot Rapping Results Report 二分&plus;拓扑排序

    题目链接:http://codeforces.com/contest/655/problem/D 大意是给若干对偏序,问最少需要前多少对关系,可以确定所有的大小关系. 解法是二分答案,利用拓扑排序看是 ...

随机推荐

  1. 微信支付 - V3支付问题

    参考资料:http://www.2cto.com/weixin/201506/407690.html   1.微信公众号支付出错: 当前页面的URL未注册: get_brand_wcpay_reque ...

  2. 关于Modelsim仿真速度的优化

    如果在不需要波形,只需要快速知道结果的情况下,可以用优化选项.这适用于做大量case的仿真阶段.因为这一阶段多数case都是通过的,只需要快速确认即可,然后把没通过的case拿出来做全波形的仿真调试. ...

  3. &lpar;转&rpar; Dynamic memory

      In the programs seen in previous chapters, all memory needs were determined before program executi ...

  4. javascript笔记整理(数据类型强制&sol;隐式转换 )

    A.数据类型强制转换 1.转换为数值类型 Number(参数) 把任何的类型转换为数值类型 A.如果是布尔值,false为0,true为1 var a=false;alert(Number(a)); ...

  5. css高级选择器

    并集选择器 p,h1{} 交集选择器 p.first{} 后代选择器:嵌套标签 h1 span{} 子元素选择器 h1>span{} 属性选择器 input[type="passwor ...

  6. 并行模式库PPL应用实战(一):使用task类创建并行任务

    自 VS2010 起,微软就在 CRT 中集成了并发运行时(Concurrency Runtime),并行模式库(PPL,Parallel Patterns Library)是其中的一个重要组成部分. ...

  7. 【BZOJ3262】陌上花开(CDQ分治)

    [BZOJ3262]陌上花开(CDQ分治) 题解 原来放过这道题目,题面在这里 树套树的做法也请点上面 这回用CDQ分治做的 其实也很简单, 对于第一维排序之后 显然只有前面的对后面的才会产生贡献 那 ...

  8. &lbrack;HAOI2008&rsqb;下落的圆盘

    Description 有n个圆盘从天而降,后面落下的可以盖住前面的.求最后形成的封闭区域的周长.看下面这副图, 所有的红 色线条的总长度即为所求. Input 第一行为1个整数n,N<=100 ...

  9. GSON TypeToken 解决泛型问题

    Java进阶(四)Java反射TypeToken解决泛型运行时类型擦除的问题解决 在开发时,遇到了下面这条语句,不懂,然习之. private List<MyZhuiHaoDetailModel ...

  10. &lbrack;JS&rsqb;js中判断变量类型函数typeof的用法汇总&lbrack;转&rsqb;

    1.作用: typeof 运算符返回一个用来表示表达式的数据类型的字符串.  可能的字符串有:"number"."string"."boolean&q ...