| 记录编号 |
388307 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
2598.美丽的感觉 |
最终得分 |
100 |
| 用户昵称 |
Hyoi_0Koto |
是否通过 |
通过 |
| 代码语言 |
C++ |
运行时间 |
0.000 s |
| 提交时间 |
2017-03-28 20:23:17 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cctype>
#define gys mylove
using namespace std;
const int MAXN=1e3+10;
bool dp[MAXN+2][MAXN+2];
char a[MAXN+2],b[MAXN+2];
int n;
inline void in(int &x)
{
x=0;int f=1;char t=getchar();
while(!isdigit(t)){if(t=='-')f=-1;t=getchar();}
while(isdigit(t)){x=x*10+t-48;t=getchar();}
x*=f;
}
inline bool dfs(int x,int y){
if(!x&&!y)return true;
if(!dp[x][y])dp[x][y]=true;
else return false;
if((x-2)>=0&&a[x-1]!=a[x]&&dfs(x-2,y)){
return true;
}
if((y-2)>=0&&b[y-1]!=b[y]&&dfs(x,y-2)){
return true;
}
if((y-1)>=0&&(x-1)>=0&&a[x]!=b[y]&&dfs(x-1,y-1)){
return true;
}
return false;
}
inline void work(){
in(n);
scanf("%s%s",a+1,b+1);
if(!dfs(n,n))printf("Impossible!");
else printf("Accepted!");
}
int Main(){
freopen("card_.in","r",stdin);
freopen("card_.out","w",stdout);
work();
return 0;
}
int main(){;}
int gys=Main();