data structures implementation sortings *1100

Please click on ads to support us..

Python Code:

numOfInitialErrors = int(input())
firstLineOfErrors = sorted([int(x) for x in input().split()])
secondLineOfErrors = sorted([int(x) for x in input().split()]) + [""]
thirdLineOfErrors = sorted([int(x) for x in input().split()]) + ["",""]

for error1, error2 in zip(firstLineOfErrors,secondLineOfErrors):
    if error1 != error2:
        print(error1)
        break

for error1, error2 in zip(secondLineOfErrors,thirdLineOfErrors):
    if error1 != error2:
        print(error1)
        break

C++ Code:

/*
                a           m     m      iiiiiiiiiiii tttttttttt
               a a         m  m m  m          i           t
             a    a       m    m    m         i           t
            aaaaaaaa     m           m        i           t
           a        a   m             m       i           t
          a          a m               m iiiiiiiiiiii     t                            */
 
 
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<string>
#include<math.h>
#include<algorithm>
#include <vector>
#define ll long long
#include<set>
#include<numeric>
#include<stack>
#include<map>
#include<iomanip>
#define pb push_back
#define mp make_pair
#define all(x)            (x).begin(),(x).end()
#define allr(x)    (x).begin(),(x).end(),greater<ll>()
#define nl  "\n"
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repb(i,a,b)  for(ll i=a;i>=b;i--)
#define ull unsigned long long
//#include<unordered_set>
//#include<unordered_map>

using namespace std;

  
/*
 bool isPrime(ll n) {if (n == 2 || n == 3 || n == 5) {return true; } if (n % 2 == 0 || n % 3 == 0) {return false; } for (ll i=5; i*i<=n; i=i+6) {if (n%i == 0 || n%(i+2) == 0) {return false; } } return true; }

*/


/*
bool ispowoftwo(ll n){
    
    for(ll i=1;i<=47;i++){
        if(pow(2,i)==n){
            return true;
        }
        
    }
    
}
*/
/*
ll binsearch(ll arr[],ll n , ll xj){
	//cout<<"agya bc"<<endl;
	ll low = 0;
	ll high = n-1;
	ll mid;
ll ans ; 
	while(low<=high){
		 mid  = (high+low)/2;
		// cout<<"mid is "<<mid<<endl;
		if (arr[mid]<xj){
			low = mid+1;
		}
		else {
			ans = mid;
			high  = mid-1 ;
		}
	}
	//cout<<"abhi xj="<<xj<<"k liye apka answer = "<<mid+1<<endl;
	return ans +1;
}
*/

void online_judge(){
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 
}


 void sol(){

ll n;
cin>>n;

unordered_map<ll,ll> m;

rep(i,0,n){
	ll a;
	cin>>a;
	m[a]++;
}


unordered_map<ll,ll> m2;
rep(i,0,n-1){
	ll a; cin>>a;
	m[a]--;
	m2[a]++;
	
}


for(auto val:m){
    if(val.second>0){
	cout<<val.first<<nl;
}
}

rep(i,0,n-2){
	ll a; cin>>a;

	m2[a]--;
}

for(auto val:m2){
	  if(val.second>0){
	cout<<val.first<<nl;
}
}
return;

}

 
int main(){

//online_judge();
   sol(); 


}	


Comments

Submit
0 Comments
More Questions

43A - Football
50A - Domino piling
479A - Expression
1480A - Yet Another String Game
1216C - White Sheet
1648A - Weird Sum
427A - Police Recruits
535A - Tavas and Nafas
581A - Vasya the Hipster
1537B - Bad Boy
1406B - Maximum Product
507B - Amr and Pins
379A - New Year Candles
1154A - Restoring Three Numbers
750A - New Year and Hurry
705A - Hulk
492B - Vanya and Lanterns
1374C - Move Brackets
1476A - K-divisible Sum
1333A - Little Artem
432D - Prefixes and Suffixes
486A - Calculating Function
1373B - 01 Game
1187A - Stickers and Toys
313B - Ilya and Queries
579A - Raising Bacteria
723A - The New Year Meeting Friends
302A - Eugeny and Array
1638B - Odd Swap Sort
1370C - Number Game