1076: SPY

时间限制: 1 Sec  内存限制: 128 MB

提交: 6  解决: 6

题目描述

The National Intelligence Council of X Nation receives a piece of credible information that Nation Y will send spies to steal
Nation X’s confidential paper. So the commander of The National Intelligence Council take measures immediately,
he will investigate people who will come into NationX. At the same time, there are two List in the Commander’s hand, one is full of spies that Nation Y will send to Nation X, and the other one is full of spies that Nation X has sent to Nation Y before.
There may be some overlaps of the two list. Because the spy may act two roles at the same time, which means that he may be the one that is sent from Nation X to Nation Y, we just call this type a “dual-spy”. So Nation Y may send “dual_spy” back to Nation X,
and it is obvious now that it is good for Nation X, because “dual_spy” may bring back NationY’s confidential paper without worrying to be detention by NationY’s frontier So the commander decides to seize those that are sent by NationY,
and let the ordinary people and the “dual_spy” in at the same time .So can you decide a list that should be caught by the Commander?

A:the list contains that will come to the NationX’s frontier.

B:the list contains spies that will be sent by Nation Y.

C:the list contains spies that were sent to NationY before.

输入

There are several test cases.

Each test case contains four parts, the first part contains 3 positive integers A, B, C, and A is the number which will come into the frontier. B is the number that will be sent by Nation Y, and C is the number that
NationX has sent to NationY before.

The second part contains A strings, the name list of that will come into the frontier.

The second part contains B strings, the name list of that are sent by NationY.

The second part contains C strings, the name list of the “dual_spy”.

There will be a blank line after each test case.

There won’t be any repetitive names in a single list, if repetitive names appear in two lists, they mean the same people.

输出

Output the list that the commander should caught (in the appearance order of the lists B).if no one should be caught, then , you should output “No enemy spy”.

样例输入

8 4 3
Zhao Qian Sun Li Zhou Wu Zheng Wang
Zhao Qian Sun Li
Zhao Zhou Zheng
2 2 2
Zhao Qian
Zhao Qian
Zhao Qian
Qian Sun Li

样例输出

Qian Sun Li
No enemy spy

你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

#include <iostream>
#include <cstring>
using namespace std;
string a[1005],b[1005],c[1005];
string s[1005];
int flag[1005],temp[1005];
int main()
{
int n,m,t;
while(cin>>n>>m>>t)
{
for(int i=0; i<n; i++)cin>>a[i];
memset(flag,0,sizeof(flag));
memset(temp,0,sizeof(temp));
for(int j=0; j<m; j++)
{
cin>>b[j];
for(int i=0; i<n; i++)
{
if(b[j]==a[i])
{
flag[j]=1;
break;
}
}
}
for(int k=0; k<t; k++)
{
cin>>c[k];
for(int j=0; j<m; j++)
{
if(c[k]==b[j])
{
temp[j]=1;
break;
}
}
}
int ans=0;
for(int j=0; j<m; j++)
if(flag[j]&&!temp[j])
s[ans++]=b[j];
if(!ans)cout<<"No enemy spy"<<endl;
else
{
for(int j=0; j<ans-1; j++)
cout<<s[j]<<" ";
cout<<s[ans-1]<<endl;
}
}
return 0;
}

YTU 1076: SPY的更多相关文章

  1. UVA - 1025 A Spy in the Metro[DP DAG]

    UVA - 1025 A Spy in the Metro Secret agent Maria was sent to Algorithms City to carry out an especia ...

  2. ytu 1057: 输入两个整数,求他们相除的余数(带参的宏 + 模板函数 练习)

    1057: 输入两个整数,求他们相除的余数 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 177  Solved: 136[Submit][Status ...

  3. Manthan, Codefest 16 -C. Spy Syndrome 2

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  4. 用PowerMock spy mock private方法

    在实际的工作中,经常碰到只需要mock一个类的一部分方法,这时候可以用spy来实现. 被测类: public class EmployeeService { public boolean exist( ...

  5. Jasmine测试ng Promises - Provide and Spy

    jasmine提供了很多些很实用的处理Promises的方法,首先我们来考虑下面的这个例子: angular.module("myApp.store").controller(&q ...

  6. UVa 1025 A Spy in the Metro(动态规划)

    传送门 Description Secret agent Maria was sent to Algorithms City to carry out an especially dangerous ...

  7. ytu 1058: 三角形面积(带参的宏 练习)

    1058: 三角形面积 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 190  Solved: 128[Submit][Status][Web Boar ...

  8. UVA1025---A Spy in the Metro(DP)

    http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35913 Secret agent Maria was sent to Alg ...

  9. ytu 1980:小鼠迷宫问题(DFS 深度优先搜索)

     小鼠迷宫问题 Time Limit: 2 Sec  Memory Limit: 64 MB Submit: 1  Solved: 1 [Submit][Status][Web Board] Desc ...

随机推荐

  1. jQuery 1.9升级指南

    http://www.css88.com/archives/5086 原文地址:http://jquery.com/upgrade-guide/1.9/ 翻译的不对或者不通顺的地方欢迎拍砖留言。 概述 ...

  2. hdu 3732

    #include<stdio.h> #include<string.h> int n,m,dp[10001]; int max(int a,int b) {  return a ...

  3. [转]maven编译时出现读取XXX时出错invalid LOC header (bad signature)

    maven编译时出现读取XXX时出错invalid LOC header (bad signature) 一.发现问题右击pom.xml,run as —> maven install,会看到c ...

  4. ES6__Symbol

    /** * Symbol */ /** * 1 什么是 Symbol ? * Symbol,表示独一无二的值.它是 JS 中的第七种数据类型. */ // 基本的数据类型: Null Undefine ...

  5. 7.1——函数的定义,参数传递,return语句

    函数的定义: (1)函数体是一个作用域,函数体是一个语句块,定义了函数的具体操作 (2)函数的形参类似于局部变量,只是区别是它是在函数的形参列表中定义的. (3)C++是一种静态强类型语言,对于每一次 ...

  6. BZOJ 3884 拓展欧拉定理

    3884: 上帝与集合的正确用法 Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 4142  Solved: 1907[Submit][Status][D ...

  7. hdu 4971

    记忆花搜索   dp #include <cstdio> #include <cstdlib> #include <cmath> #include <set& ...

  8. ORA-01034: ORACLE not available 出错

    调用db.rlogon("sm/sm")出现以下错误 ORA-01034: ORACLE not availableORA-27101: shared memory realm d ...

  9. Spring的@Autowired注解

    以下内容引用自http://wiki.jikexueyuan.com/project/spring/annotation-based-configuration/spring-autowired-an ...

  10. CSS 遮罩层、滑出页面

    <style> .panel_bak { position:fixed; bottom:0; display:none; width:100%; margin:0px; padding:5 ...