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

，对于多解，只要b序列在f序列有多个值对应即可，否则就只有一组解，直接映射回去即可。



#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define X first
#define Y second
#define cl(a,b) memset(a,b,sizeof(a))
typedef pair<int,int> P;
const int maxn=100005;
const LL inf=1<<27;
const LL mod=1e9+7;
int f[maxn],b[maxn];
int pos[maxn];
int tt[maxn];
vector<int> ans;
int main(){
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d",&f[i]);
pos[f[i]]++;
tt[f[i]]=i;
}
for(int i=1;i<=m;i++){
scanf("%d",&b[i]);
}
for(int i=1;i<=m;i++){
if(pos[b[i]]==0){return puts("Impossible");}
}
for(int i=1;i<=m;i++)if(pos[b[i]]>1){
return puts("Ambiguity");
}
for(int i=1;i<=m;i++){
ans.pb(tt[b[i]]);
}
printf("Possible\n%d",ans[0]);
for(int i=1;i<ans.size();i++){
printf(" %d",ans[i]);
}
puts("");
return 0;
}

#### Codeforces Round #471 (Div. 2)

2018-03-27 23:23:41

#### CF-Codeforces Round #483 (Div. 2) A~D

2018-05-16 00:48:25

#### Codeforces Round #464 (Div. 2) B. Hamster Farm

2018-02-18 12:28:34

#### Codeforces Educational Codeforces Round 41 (Rated for Div. 2) B. Lecture Sleep

2018-04-05 10:35:27

#### Codeforces Round #471 div.2 ABC题解

2018-03-24 14:16:58

#### Codeforces Round #205 (Div. 2) CodeForces 353B Two Heaps

2016-08-03 23:28:17

#### Codeforces Round #467 (Div. 2) B. Vile Grasshoppers

2018-02-27 12:59:02

#### Educational Codeforces Round 38 (Rated for Div. 2) B. Run For Your Prize

2018-02-17 13:35:37

#### CF-Codeforces Round #483 (Div. 2)-D-XOR-pyramid

2018-05-16 01:15:04

#### Codeforces Round #462 (Div. 2)

2018-02-15 00:17:30