【CodeForces】[599B]Spongebob and Joke
来源:互联网 发布:手机淘宝装修软件 编辑:程序博客网 时间:2024/05/16 12:29
记录数字出现次数及坐标
然后读取时判断能不能对应
最后判断输出方式
#include<stdio.h>#include<string.h>int cnt[100200],res[100200];int a[100200];int main() { int n,m; while(scanf("%d %d",&n,&m)!=EOF) { memset(cnt,0,sizeof(cnt)); memset(res,0,sizeof(res)); for(int i=1; i<=n; i++) { int t; scanf("%d",&t); cnt[t]++; res[t]=i; } int flag=0; for(int i=1; i<=m; i++) { scanf("%d",&a[i]); if(flag<2) { if(cnt[a[i]]==0) flag=2; else if(cnt[a[i]]>1) flag=1; } } if(flag==0) { printf("Possible\n"); for(int i=1; i<=m; i++) { printf("%d",res[a[i]]); if(i==m) printf("\n"); else printf(" "); } } else if(flag==1) printf("Ambiguity\n"); else printf("Impossible\n"); } return 0;}
题目地址:【CodeForces】[599B]Spongebob and Joke
0 0
- Codeforces 599B Spongebob and Joke 【水题】
- codeforces 599B Spongebob and Joke
- Codeforces 599 B Spongebob and Joke
- CodeForces 599B Spongebob and Joke
- CodeForces 599B A - Spongebob and Joke
- 【CodeForces】[599B]Spongebob and Joke
- CodeForces 599B Spongebob and Joke
- CodeForces 599B Spongebob and Joke【思维】
- 【 CodeForces 599B 】 Spongebob and Joke
- 599B Spongebob and Joke
- 【CodeForces】599B - Spongebob and Joke(STL)
- 【CodeForces】599B - Spongebob and Joke(STL)
- Codeforces 599B: Spongebob and Joke(技巧,规律)
- 【Codeforces】-599B-Spongebob and Joke(思维)
- Codeforces 299 B Spongebob and Joke
- CF-599B - Spongebob and Joke
- codeforce 599 B Spongebob and Joke
- Codeforces #332 B. Spongebob and Joke (思路)
- Android获取流量信息
- Cannot create a secure XMLInputFactory
- sys.setdefaultencoding()使用前,必须reload(sys)
- 基础篇:android动画效果之scale使用
- vs2013遇到“编译器中发生内部错误”的解决方法
- 【CodeForces】[599B]Spongebob and Joke
- Android注销功能
- 扬尘的监测和软件技术
- HTML手机端页面模版
- what fucking is PHP
- web前端表单(重点)
- 好玩的注释
- UITextField 限制输入字数
- 2016 Multi-University Training Contest 2 Acperience