CF599B Spongebob and Joke
思路:
模拟,注意特判。
实现:
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int pos[], x[], y[], b[], n, m, tmp;
- int main()
- {
- cin >> n >> m;
- for (int i = ; i <= n; i++)
- {
- scanf("%d", &tmp);
- x[tmp]++;
- pos[tmp] = i;
- }
- for (int i = ; i <= m; i++)
- {
- scanf("%d", &b[i]);
- y[b[i]]++;
- }
- bool f1 = true, f2 = true;
- for (int i = ; i <= n; i++)
- {
- if (y[i] && !x[i])
- {
- f1 = false;
- break;
- }
- if (x[i] > && y[i])
- {
- f2 = false;
- }
- }
- if (!f1)
- cout << "Impossible" << endl;
- else if (!f2)
- cout << "Ambiguity" << endl;
- else
- {
- cout << "Possible" << endl;
- for (int i = ; i <= m; i++)
- {
- printf("%d ", pos[b[i]]);
- }
- puts("");
- }
- return ;
- }
CF599B Spongebob and Joke的更多相关文章
- 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. 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 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. 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 ...
- Codeforces Round #332 (Div. 二) B. Spongebob and Joke
Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. ...
- codeforce 599B Spongebob and Joke
一道水题WA那么多发,也是醉了.f看成函数的话,其实就是判断一下反函数存不存在. 坑点,只能在定义域内判断,也就是只判断b[i].没扫一遍前不能确定Impossible. #include<bi ...
- CodeForces 599B Spongebob and Joke
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...
随机推荐
- java重载中的基本类型的自动类型转换
当传递到函数的参数的数据类型表示的范围小于函数形参的参数类型遵循如下原则 : char类型比较特殊, 直接转换为int: char ->int ->long->float-> ...
- udhcp源码详解(四) 之租赁IP的管理
Server端对于租赁出去的IP的管理是基于结构体dhcpOfferedAddr的,该结构体的定义是在leases.c文件里:(结构体的成员介绍说明见详解之数据结构) 1: struct dhcpOf ...
- mysql 中 unix_timestamp和from_unixtime 时间戳函数
1.unix_timestamp 将时间转化为时间戳.(date 类型数据转换成 timestamp 形式整数) 没传时间参数则取当前时间的时间戳 mysql> select unix_time ...
- ffmpeg转码本地文件(一)
ffmpeg转码本地文件(一) 实现目标:输入本地文件.实现本地文件转码,里面包括mux层转码,codec层转码,视频格式转换,音频重採样等功能,功能点请看凝视.注意:凝视非常重要. #ifndef ...
- select case when if
select case when if 的一些用法 - 马丁传奇 - 博客园 https://www.cnblogs.com/martinzhang/p/3220595.html Write a SQ ...
- Android4.4.2系统添加自定义按键【转】
本文转载自:http://developer.t-firefly.com/thread-251-1-1.html 网上存在一些关于Android系统添加自定义按键的文章,但大多针对Android2.3 ...
- lmbench andlmbench 移植测试
/*********************************************************************** * lmbench andlmbench 移植测试 * ...
- C# ListView 列宽调整 刷新
/*********************************************************************** * C# ListView 列宽调整 刷新 * 说明: ...
- [转]python_常用断言assert
原文地址:http://www.jianshu.com/p/eea0b0e432da python自动化测试中寻找元素并进行操作,如果在元素好找的情况下,相信大家都可以较熟练地编写用例脚本了,但光进行 ...
- JavaScript-Tool:CKFinder
ylbtech-JavaScript-Tool:CKFinder 1.返回顶部 CKFinder是一个强大而易于使用的Web浏览器的Ajax文件管理器. 其简单的界面使得它直观,快速学习的各类用户,从 ...