简单题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; const int maxn=+;
int n,m;
int b[maxn],f[maxn]; int cnt[maxn]; int main()
{
scanf("%d%d",&n,&m);
memset(cnt,,sizeof cnt);
for(int i=;i<=n;i++)
{
scanf("%d",&f[i]);
cnt[f[i]]++;
}
for(int i=;i<=m;i++) scanf("%d",&b[i]); bool fail=;
for(int i=;i<=m;i++) if(cnt[b[i]]==) fail=; if(fail==) printf("Impossible\n");
else
{
fail=;
for(int i=;i<=m;i++) if(cnt[b[i]]>) fail=;
if(fail) printf("Ambiguity\n");
else{
printf("Possible\n");
memset(cnt,,sizeof cnt);
for(int i=;i<=n;i++) cnt[f[i]]=i;
for(int i=;i<=m;i++) printf("%d ",cnt[b[i]]);
printf("\n");
}
}
return ;
}

CodeForces 599B Spongebob and Joke的更多相关文章

  1. Codeforces 599B. Spongebob and Joke 模拟

    B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  2. codeforce 599B Spongebob and Joke

    一道水题WA那么多发,也是醉了.f看成函数的话,其实就是判断一下反函数存不存在. 坑点,只能在定义域内判断,也就是只判断b[i].没扫一遍前不能确定Impossible. #include<bi ...

  3. Codeforces Round #332 (Div. 2) B. Spongebob and Joke 水题

    B. Spongebob and Joke Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599 ...

  4. Codeforces Round #332 (Div. 2)_B. Spongebob and Joke

    B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  5. Codeforces Round #332 (Div. 2)B. Spongebob and Joke

    B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  6. Codeforces Round #332 (Div. 2) B. Spongebob and Joke 模拟

    B. Spongebob and Joke     While Patrick was gone shopping, Spongebob decided to play a little trick ...

  7. CF-599B - Spongebob and Joke

    B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  8. Codeforces Round #332 (Div. 二) B. Spongebob and Joke

    Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. ...

  9. Codeforces 599D Spongebob and Squares(数学)

    D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...

随机推荐

  1. Linux上用mvn安装node.js

    Linux上用mvn安装node.js 上一篇blog简略的讲了ubuntu系统的安装,接下来讲讲Ubuntu上的基于node.js的web开发环境的搭建. Node在快速构建网络服务有着极大的优势, ...

  2. ubuntu4.04服务器添加虚拟主机

    buntu 14.04配置虚拟主机   虚拟主机常用于在一个单独的IP地址上提供多个域名的网站服务.如果有人想在单个VPS的单个IP地址运行多个网站,这是非常有用的.在这个教程中,让我告诉你如何设置在 ...

  3. JAVA自带的加密算法-MD5\SHA1\BASE64

    需要导入jar包: commons-codec.jar MD5 String str = "abc"; DigestUtils.md5Hex(str); SHA1 String s ...

  4. Android(java)学习笔记181:多媒体之图片画画板案例

    1.首先我们编写布局文件activity_main.xml如下: <RelativeLayout xmlns:android="http://schemas.android.com/a ...

  5. Django-常用设置(settings.py)

    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 当前项目的根目录,Django会依此来定位工程内的相关文件 ...

  6. 一丶webservice执行存储过程

    返回值组合: json返回 StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("\&qu ...

  7. [SNOI2019]数论

    题目 考虑对于每一个\(a_i\)计算有多少个\(0<x\leq T-1\)满足\(x\equiv a_i(mod\ P)\)且\(x\ mod\ Q \in B\) 显然\(x=a_i+k\t ...

  8. 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H)

    目录 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H) 竞赛事件相关 竞赛链接 竞赛题目 总结 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H) 竞赛事件相关 竞赛 ...

  9. hdu3094 A tree game

    题目描述 题解: 树上删边. $SG[u]$^=$SG[son[u]]+1$ 代码: #include<cstdio> #include<cstring> ; template ...

  10. 为公司内部搭建CA

    步骤一 首先我们要知道CA的配置文件 openssl的配置文件:/etc/pki/tls/openssl.cnf 我们打开这个配置文件 这文件中很多跟CA相关的信息如图 解释: 我们可以搭建好几个CA ...