cf find the bone

来源:互联网 发布:echarts源码 编辑:程序博客网 时间:2024/06/15 06:59
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a[100005];
int main()
{
    int n,m,k;
    while(cin>>n>>m>>k)
    {
        memset(a,0,sizeof(a));
        for(int i=0;i<m;i++)
        {
            int tmp;
            scanf("%d",&tmp);
            a[tmp]++;
        }
        int flag=0;
        int x,y;
        while(k--)
        {
            scanf("%d%d",&x,&y);
            if(a[y]==1&&flag==0)flag=y;
        }
        if(flag==0)flag=y;
        cout<<flag<<endl;
    }
    return 0;
}