SPY NBUT-1220---

Source: Internet
Author: User

Description:
The National Intelligence Council of X Nation receives a piece of credible information that Nation Y would send spies to S Teal Nation X ' s confidential paper. So the commander of the National Intelligence Council take measures immediately, he'll investigate people who'll come Into Nationx. At the same time, there is both List in the Commander ' s hand, one is full of spies that Nation Y would send to Nation X, an D The other one are full of spies that Nation X have sent to Nation Y before. There may some overlaps of the list. Because The Spy may act of the roles at the same time, which means that he could be the the one that's sent from Nation X to Natio N Y, we just call this type a "Dual-spy". So Nation Y could send "Dual_spy" Back to Nation X, and it was obvious now that it was good for Nation X, because "Dual_spy" M Ay bring back nationy ' s confidential paper without worrying to being detention by Nationy ' s frontier so the commander decides To seize those that is sent by Nationy, and let the ORDinary people and the "Dual_spy" in at the same time. So can I decide a list that should is caught by the Commander?

A:The list contains that would come to the Nationx ' s frontier.

B:the list contains spies that'll be is sent by Nation Y.

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

Input
There is several test cases.
Each test case contains four parts, the first part contains 3 positive integers A, B, C, and A are the number which would co Me into the frontier. B is the number of that would be sent by Nation Y, and C is the number of that Nationx have sent to Nationy before.
The second part contains A strings and the name list of that would come into the frontier.
The second part contains B strings and the name list of that is sent by Nationy.
The second part contains C strings, the name list of the "Dual_spy".
There'll is a blank line after each test case.
There won ' is any repetitive names in a single list, if repetitive names appear in both lists, they mean the same people.
Output
Output the list, the commander should caught (in the appearance order of the lists B). If no one should is caught, then , you should output "No enemy Spy".
Sample Input
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
Sample Output
Qian Sun Li
No Enemy Spy

Summary:
1, attention, in the order of B output.
2, try to use vector,map should be more simple.

Code:

#include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <

string> #include <cstring> #include <math.h> #include <vector> using namespace std;
    int main () {//freopen ("In.txt", "R", stdin);
    int a,b,c;
    Vector<string> As,bs;
    Vector<bool> FLAGB;
    string S;
    BOOL Start=false;
        while (~SCANF ("%d%d%d", &a,&b,&c)) {as.clear ();
        Bs.clear ();
        Flagb.clear ();
        Start=false;
            for (int i=0;i<a;i++) {cin>>s;
        As.push_back (s);
            } for (int i=0;i<b;i++) {cin>>s;
            Bs.push_back (s);
            Flagb.push_back (FALSE);
                    for (int j=0;j<as.size (); j + +) if (S==as[j]) {flagb[i]=true;
                Break }} for (int i=0;i<c;i++) {CIn>>s;
                    for (int j=0;j<bs.size (); j + +) if (S==bs[j]) {flagb[j]=false;
                Break
                }} for (int i=0;i<bs.size (); i++) {if (flagb[i]==true) {
                   if (!start) {cout<<bs[i];
                Start=true;
            } else cout<< "" <<Bs[i];
        }} if (!start) cout<< "No enemy Spy";
    cout<<endl;
} return 0;
 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.