简单题。

#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. vue-devtools在google浏览器下安装扩展

    下载vue-devtools,地址: https://github.com/vuejs/vue-devtools 解压到对应目录,eg: D:\ProgramFiles\vue-devtools-de ...

  2. jdbc获取数据具体过程

    下面是个最简单的使用jdbc取得数据的应用.在例子之后我将分成4步,分别是①取得连接,②创建PreparedStatement,③设置参数,④执行查询,来分步分析这个过程.除了设置参数那一步之外,其他 ...

  3. SQL系列学习 存储过程&事物语法

    /*学习事物基本语法*/ /*增加课室名的唯一索引*/ ALTER table class add constraint uni_ClassName unique(name) /*创建存储过程,其中增 ...

  4. git项目常用命令

    git rm --cached 文件名    //移除不上传 git add .    //添加所有文件 .gitignore   //git忽略不想上传或者不需要上传的文件 REAMDE.md  文 ...

  5. 自定义Jquery 下拉框

    (function ($){ 'use strict'; var g_id = 0; var g_open_id = []; $.fn.select3 = function () { var _id ...

  6. 解决Homestead yarn , npm run dev, 命令报错问题!

    解决Homestead yarn , npm run dev, 命令报错问题! 2018年06月01日 11:50:51 偶尔发发颠 阅读数:1654    版权声明:本文为博主原创,未经博主同意,不 ...

  7. Must set property 'expression' before attempting to match

    因为这个问题没有直接指向问题的地点, 所以找起来不是很容易. 但是如果找不到, 这个错就会一直都存在. 原因分析: 在使用切面编程的时候, 没有把切入点配置全面 解决方法: 在before, afte ...

  8. Moebius for SQLServer负载均衡

    搞数据库的都知道:在Oracle上有RAC集群,MySQL也有对应的方案,而SQL Server上直到SQL Server 2012版本的AlwaysOn到来,微软都没有提供一个负载均衡方案,在网上看 ...

  9. ping ip

    def ip_and_time(): """ get ip to ping from ip.txt then return two list , each ip that ...

  10. Xcode导入第三方库

    Xcode导入第三方库,例如TapkuLibrary iOS开源框架Tapku下载地址:https://github.com/devinross/tapkulibrary.git 1.创建你的工程项目 ...