Sunday 1 March 2015

Codeforces Round #294 (Div. 2) A and B and Compilation Errors

Problem: A and B and Compilation Errors

///     Raihan Ruhin
///     CSE, Jahangirnagar University.
///     Dhaka-Bangladesh.
///     id: raihanruhin (topcoder / codeforces / codechef / hackerrank / uva / uvalive / spoj), 3235 (lightoj)
///     mail: raihanruhin@ (yahoo / gmail / facebook)
///     blog: ruhinraihan.blogspot.com

#include<bits/stdc++.h>
using namespace std;

#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)

#define MOD 1000000007
#define MX 100010


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int tc,kk=1, n, x;
    vector<int>a, b, c;
    map<int, int>mp;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);
    }
    bool taken=false;
    for(int i=0;i<n-1;i++)
    {
        cin>>x;
        b.push_back(x);
    }
    for(int i=0;i<n-2;i++)
    {
        cin>>x;
        c.push_back(x);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    for(int i=0;i<n-1;i++)
    {
        if(a[i]!=b[i])
        {
            cout<<a[i]<<"\n";
            taken=true;
            break;
        }
    }
    if(!taken) cout<<a[n-1]<<"\n";
    taken=false;
    for(int i=0;i<n-2;i++)
    {
        if(b[i]!=c[i])
        {
            cout<<b[i];
            taken=true;
            break;
        }
    }
    if(!taken)
        cout<<b[n-2];
    return 0;
}

No comments:

Post a Comment