http://codeforces.com/gym/100623/attachments E题
http://codeforces.com/gym/100623/attachments E题
第一个优化
它虽然是镜像对称,但它毕竟是一一对称的,所以可以匹配串和模式串都从头到尾颠倒一下
第二个优化,与次数无关,所以排个序就完事了
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<stack>
#include<cstring>
#define inf 2147483647
#define ls rt<<1
#define rs rt<<1|1
#define lson ls,nl,mid,l,r
#define rson rs,mid+1,nr,l,r
#define N 100010
#define For(i,a,b) for(int i=a;i<=b;i++)
#define p(a) putchar(a)
#define g() getchar() using namespace std;
int n;
char a[],b[],c[],d[]; struct node{
int f;
int s;
bool operator < (const node & temp)const{
if(f==temp.f)
return s<temp.s;
return f<temp.f;
}
}a1[],a2[]; void in(int &x){
int y=;
char c=g();x=;
while(c<''||c>''){
if(c=='-')y=-;
c=g();
}
while(c<=''&&c>=''){
x=(x<<)+(x<<)+c-'';c=g();
}
x*=y;
}
void o(int x){
if(x<){
p('-');
x=-x;
}
if(x>)o(x/);
p(x%+'');
}
int main(){
freopen("enchanted.in","r",stdin);
freopen("enchanted.out","w",stdout);
cin>>(a+)>>(b+)>>(c+)>>(d+);
n=strlen(a+);
For(i,,n){
a1[i].f=a[i]-'A'+;
a1[i].s=b[n-i+]-'A'+;
}
For(i,,n){
a2[i].f=c[i]-'A'+;
a2[i].s=d[n-i+]-'A'+;
}
sort(a1+,a1+n+);
sort(a2+,a2+n+);
For(i,,n)
if(a1[i].f!=a2[i].f||a1[i].s!=a2[i].s){
cout<<"No";
return ;
}
cout<<"Yes";
return ;
}
http://codeforces.com/gym/100623/attachments E题的更多相关文章
- http://codeforces.com/gym/100623/attachments H题
http://codeforces.com/gym/100623/attachments H题已经给出来的,包括后来添加的,都累加得到ans,那么从1-ans都是可以凑出来的,如果ans<a[n ...
- Codeforces Gym 100531G Grave 水题
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...
- 【codeforces.com/gym/100240 J】
http://codeforces.com/gym/100240 J [分析] 这题我搞了好久才搞出样例的11.76....[期望没学好 然后好不容易弄成分数形式.然后我‘+’没打..[于是爆0... ...
- Codeforces Round #378 (Div. 2) D题(data structure)解题报告
题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常 ...
- Codeforces 828B Black Square(简单题)
Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. ...
- Codeforces Round #612 (Div. 2) 前四题题解
这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...
- Codeforces Gym 100286I iSharp 水题
Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- CodeForces Gym 100685C Cinderella (水题)
题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要 ...
- Codeforces Round #271 (Div. 2) E题 Pillars(线段树维护DP)
题目地址:http://codeforces.com/contest/474/problem/E 第一次遇到这样的用线段树来维护DP的题目.ASC中也遇到过,当时也非常自然的想到了线段树维护DP,可是 ...
随机推荐
- 转帖 最全的HTML、CSS知识点总结,浅显易懂
一,html+css基础1-1Html和CSS的关系学习web前端开发基础技术需要掌握:HTML.CSS.JavaScript语言.下面我们就来了解下这三门技术都是用来实现什么的:1. HTML是网页 ...
- oracle 查询及删除表中重复数据
create table test1( id number, name varchar2(20) ); ,'jack'); ,'jack'); ,'peter'); ,'red'); insert i ...
- c#高级写法
Linq的参考资料:https://www.cnblogs.com/liqingwen/p/5801249.html 1.判断str字符串中的逗号个数 string str = "1,2,3 ...
- MySQL搭建Amoeba_读写分离
一.背景知识 Amoeba(变形虫)项目,专注 分布式数据库 proxy 开发.座落与Client.DB Server(s)之间.对客户端透明.具有负载均衡.高可用性.sql过滤.读写分离.可路由相关 ...
- [Matlab] Galois Field arrays
Operations supported for Galois Field arrays: + - - Addition and subtraction of Galois arrays. * / \ ...
- [shell基础]——echo命令
echo命令:在shell中主要用于输出 1. -n 不换行的显示结果(默认是换行的) 2. -e " " 支持双引号中使用一些特殊字符 常用的特殊字符有 \a 发出警告 ...
- 基于RBAC模式的权限管理系统设计概要
很多人都知道以角色为基础的权限管理设计(RBAC),但是大部分人似懂非懂,不知道完整的权限管理系统都包括哪些内容. 在此以权限管理的使用场景来说明一下完整的权限管理内容. 一是鉴权管理,即权 ...
- 操作系统-Interrupts
- Mybatis generator 逆向生成代码
Mybatis generator 逆向生成代码 简单介绍 本文介绍用mybatis逆向生成javaben dao接口 1.创建maven项目 创建相应的包 附上项目创建完成的图片 然后在pom.xm ...
- python作业-网络编程
1.什么是C/S架构? 答:C指的是client(客户端软件),S指的是Server(服务端软件) 2.互联网协议是什么?分别介绍五层协议中每一层的功能? 答:互联网的核心就是由一堆协议组成.如果把计 ...