View Code of Problem 7

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#include <map>
#include <set>
#include <queue>
using namespace std;
int Hash[1000010];

    int main()
    {
        #ifdef  ONLINE_JUDGE
        #else
        freopen("1.txt","r",stdin);
        #endif
        int k;
        cin>>k;
        while(k--)
        {
            memset(Hash,0,sizeof(Hash));
            int n;
            cin>>n;
            while(n--)
            {
                int a,b;
                cin>>a;
                getchar();
                cin>>b;
                Hash[a]=b;
                Hash[b]=a;
            }
            int m;
            cin>>m;
            while(m--)
            {
                int a;
                cin>>a;
                if(Hash[a]!=0) cout<<Hash[a];
                else cout<<"UNKNOW";
                if(m>0) cout<<endl;
            }
            if(k>0) cout<<endl<<endl;
        }

        return 0;
    }


/*
Main.cc: In function 'int main()':
Main.cc:25:39: error: 'memset' was not declared in this scope
             memset(Hash,0,sizeof(Hash));
                                       ^
*/

Double click to view unformatted code.


Back to problem 7