简单题。

#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. UVM基础之------uvm_transaction

    uvm_transaction继承自uvm_object,添加了timing和recording接口,该类是uvm_sequence_item的基类.下边将做剖析 1. 这个类提供了时间戳属性(tim ...

  2. postman使用--断言

    前戏 在我们测接口的时候,没有断言的接口都是耍流氓,因为做自动化的时候,不加断言我们不知道这个接口是执行成功了还是执行失败了,所以断言是做接口自动化必须的 断言 断言就是我们预期值和接口返回值是否一样 ...

  3. List去重复数据

    for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {  for ( int j = list.size() - 1 ; j > i; j -- ...

  4. vector性能调优之resize与reserve

    vector的resize与reserve reserve()函数为当前vector预留至少共容纳size个元素的空间.(译注:实际空间可能大于size) resize() 函数( void resi ...

  5. Mysql+MHA高可用集群

    http://www.ttlsa.com/mysql/step-one-by-one-deploy-mysql-mha-cluster/

  6. 文件默认权限umask掩码

    umask命令 作用:用于显示.设置文件的缺省权限 格式:umask   [-S] -S表示以rwx形式显示新建文件缺省权限 系统的默认掩码是0022 文件创建时的默认权限 = 0666 - umas ...

  7. Python的Turtle绘制纳兹咩的娘口三三

    今天看完夏目友人帐的大电影,哭成了泪猴~ 所以我打算用Python画一只娘口三三陪伴在我身边 不过.. 画的太丑,还没上色..,你们可以完善一下~ 代码放在这里了 import turtle as t ...

  8. Nginx安装及基本配置

    本文内容: 90%来自以下网址:http://www.nginx.cn/install ,修改了一些版本信息 10%来自以下网址:http://nginx.org/en/docs/beginners_ ...

  9. zzuli 1905 小火山的跳子游戏

    Description   小火山和火山火山在一块玩跳子游戏.规则如下:   1:跳子的起始位置为0,棋盘大小从1到N   2:每次跳子跳k步. 例如当前位置为i, 那么下一步为i + k   3:跳 ...

  10. MVC Remote属性验证

    模型验证方式一: 1.需要添加引用: using System.Web.Mvc; 2.在模型属性上添加验证: [Remote("CheckIsHaveSerialNo", &quo ...