CodeForces 599B Spongebob and Joke
简单题。
#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的更多相关文章
- Codeforces 599B. Spongebob and Joke 模拟
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- codeforce 599B Spongebob and Joke
一道水题WA那么多发,也是醉了.f看成函数的话,其实就是判断一下反函数存不存在. 坑点,只能在定义域内判断,也就是只判断b[i].没扫一遍前不能确定Impossible. #include<bi ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- CF-599B - Spongebob and Joke
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- Codeforces Round #332 (Div. 二) B. Spongebob and Joke
Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. ...
- Codeforces 599D Spongebob and Squares(数学)
D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculati ...
随机推荐
- Hive工具类
Hive2.x的工具类,对常用方法进行了封装,其中设置了kerberos认证. package com.ideal.template.openbigdata.util; import java.sql ...
- GitHub简单命令行# 使用命令行传代码到GitHub
第一次提交代码到Github 第一步: 建立本地仓库cd到你的本地项目根目录下,执行git命令 cd到本地项目 git init 第二步: 将本地项目工作区的所有文件添加到暂存区 git add . ...
- leetcode_919. Complete Binary Tree Inserter_完全二叉树插入
https://leetcode.com/problems/complete-binary-tree-inserter/ 给出树节点的定义和完全二叉树插入器类的定义,为这个类补全功能.完全二叉树的定义 ...
- About the iOS File System
两个维度: 1)是否给用户使用: 2)是否持久存储. During installation of a new app, the installer creates a number of conta ...
- 插入insert几种用法
1.insert ignore into 当插入数据时,如出现错误时,如重复数据,将不返回错误,只以警告形式返回.所以使用ignore请确保语句本身没有问题,否则也会被忽略掉.例如: INSERT I ...
- Jquery中children与find之间的区别
<table id="tb"> <tr> <td>0</td> <td>1</td> <td>2 ...
- shell $() vs ${}
reference $( )与` `(反引号)都是用来做命令替换(command substitution)用的 run command 3, 2, 1 command1 $(command2 $(c ...
- selenium Select下拉框
先来认识一下下拉框,以百度的“高级设置”为例 介绍两种方法来处理下拉框:使用click事件,使用Select方法 使用click事件 上述下拉框的源代码如下: 虽然我们可以在html源文件中看到sel ...
- MariaDB数据库(二)
1. MariaDB数据类型 MariaDB数据类型可以分为数字,日期和时间以及字符串值. 使用数据类型的原则:够用就行,尽量使用范围小的,而不用大的. 1.1 常用的数据类型 整数:int,bit ...
- Linux启动流程CentOS6和7的区别
目 录 Linux启动流程 I 第1章 CentOS6启动流程 1 1.1 BIOS 1 1.2 MBR 1 1.3 GRUB 1 1.4 kernel(加载内核) ...