text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int sa = 0, sb = 0, sc = 0;
long long int a, b, c;
for (int i = 0; i < n; i++) {
cin >> a;
sa += a;
}
for (int i = 0; i < n - 1; i++) {
cin >> b;
sb += b;
}
for (int i = 0; i < n - 2; i++) {
cin >> c;
sc += c;
}
long long int res1 = sa - sb, res2 = sb - sc;
cout << res1 << '\n' << res2;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005], c[100005];
int n;
void Init() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
for (int i = 1; i < n; i++) scanf("%d", &b[i]);
for (int i = 1; i < n - 1; i++) scanf("%d", &c[i]);
}
void Work() {
sort(a + 1, a + n + 1);
sort(b + 1, b + n);
for (int i = 1; i <= n; i++)
if (a[i] != b[i]) {
printf("%d\n", a[i]);
c[n - 1] = a[i];
break;
}
sort(c + 1, c + n);
for (int i = 1; i <= n; i++)
if (a[i] != c[i]) {
printf("%d\n", a[i]);
break;
}
}
int main() {
Init();
Work();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int arr[100000], arr2[100000], arr3[100000];
int main() {
int n;
string s;
cin >> n;
for (int i = 0; i < n; i++) cin >> arr[i];
sort(arr, arr + n);
for (int i = 0; i < n - 1; i++) cin >> arr2[i];
sort(arr2, arr2 + (n - 1));
for (int i = 0; i < n - 2; i++) cin >> arr3[i];
sort(arr3, arr3 + (n - 2));
for (int i = 0; i < n; i++) {
if (arr[i] != arr2[i]) {
cout << arr[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (arr2[i] != arr3[i]) {
cout << arr2[i];
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, x, sum = 0, sum1 = 0, sum2 = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
sum += x;
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &x);
sum1 += x;
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &x);
sum2 += x;
}
printf("%d\n%d\n", sum - sum1, sum1 - sum2);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int num;
cin >> num;
vector<int> v1(num);
vector<int> v2(num - 1);
vector<int> v3(num - 2);
int a = 0, b = 0, c = 0;
for (int i = 0; i < num; i++) {
cin >> v1[i];
a += v1[i];
}
for (int i = 0; i < num - 1; i++) {
cin >> v2[i];
b += v2[i];
}
for (int i = 0; i < num - 2; i++) {
cin >> v3[i];
c += v3[i];
}
cout << a - b << " " << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
long long int n, ar[100000], err_1 = 0, err_2 = 0, err_3 = 0, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> ar[i];
err_1 = err_1 + ar[i];
}
for (i = 0; i < n - 1; i++) {
cin >> ar[i];
err_2 = err_2 + ar[i];
}
for (i = 0; i < n - 2; i++) {
cin >> ar[i];
err_3 = err_3 + ar[i];
}
cout << err_1 - err_2 << endl;
cout << err_2 - err_3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp2;
map<int, int> mp1;
map<int, int> mp;
int n, B, C;
int main() {
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]]++;
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
mp1[b[i]]++;
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
mp2[c[i]]++;
}
for (int i = 0; i < n; i++) {
if (mp[a[i]] != mp1[a[i]]) {
B = a[i];
}
if (mp[a[i]] != mp2[a[i]] && mp2[a[i]] < mp1[a[i]]) {
C = a[i];
}
}
cout << B << '\n' << C;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, a, j, n;
long long c, sum, s[3];
cin >> n;
for (i = 0; i < 3; i++) {
sum = 0;
for (j = 0; j < n - i; j++) {
cin >> a;
sum += a;
}
if (i) s[i] = c - sum;
c = sum;
}
cout << s[1] << endl << s[2] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
int n;
cin >> n;
int s1 = 0, s2 = 0, s3 = 0;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
s1 += x;
}
for (int i = 0; i < n - 1; ++i) {
int x;
cin >> x;
s2 += x;
}
for (int i = 0; i < n - 2; ++i) {
int x;
cin >> x;
s3 += x;
}
cout << (s1 - s2) << "\n";
cout << (s2 - s3) << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
map<long long, int> m1;
map<long long, int> md;
vector<long long> a;
map<long long, int> m2;
map<long long, bool> mc;
for (int i = 0; i < n; i++) {
long long x;
cin >> x;
md[x]++;
a.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
long long x;
cin >> x;
m1[x]++;
}
for (int i = 0; i < n - 2; i++) {
long long x;
cin >> x;
m2[x]++;
}
for (int i = 0; i < n; i++)
if (md[a[i]] > m1[a[i]]) {
cout << a[i] << endl;
m2[a[i]]++;
mc[i] = true;
break;
}
for (int i = 0; i < n; i++)
if (md[a[i]] > m2[a[i]] && mc[i] == false) {
cout << a[i];
break;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
int b[n - 1];
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
sort(b, b + n - 1);
int c[n - 2];
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(c, c + n - 2);
int flag = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
flag = 1;
cout << a[i] << endl;
break;
}
}
if (!flag) {
cout << a[n - 1] << endl;
}
flag = 0;
for (int i = 0; i < n - 2; i++) {
if (b[i] != c[i]) {
flag = 1;
cout << b[i] << endl;
break;
}
}
if (!flag) {
cout << b[n - 2] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, x = 0, y = 0;
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (i = 0; i < n; i++) cin >> a[i];
for (i = 0; i < n - 1; i++) cin >> b[i];
for (i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (i = 0; i < n; i++) {
x++;
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
if (x == n) cout << a[n - 1] << endl;
}
for (i = 0; i < n - 1; i++) {
y++;
if (b[i] != c[i]) {
cout << b[i];
break;
}
if (y == n - 1) cout << b[n - 2] << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
list<int> l1, l2, l3, l4;
int main() {
int n, t, a, c;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
l1.push_back(t);
}
for (int i = 0; i < n - 1; i++) {
cin >> t;
l2.push_back(t);
l4.push_back(t);
}
for (int i = 0; i < n - 2; i++) {
cin >> t;
l3.push_back(t);
}
l1.sort();
l2.sort();
l3.sort();
l4.sort();
for (list<int>::iterator it = l1.begin(), itr = l2.begin(); it != l1.end();
it++, itr++) {
if (*it != *itr) {
a = *it;
break;
}
}
for (list<int>::iterator it = l4.begin(), itr = l3.begin(); it != l4.end();
it++, itr++) {
if (*it != *itr) {
c = *it;
break;
}
}
cout << a << "\n" << c << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, i, a, p = 0, q = 0, r = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
p = p + a;
}
for (i = 0; i < n - 1; i++) {
cin >> a;
q = q + a;
}
for (i = 0; i < n - 2; i++) {
cin >> a;
r = r + a;
}
cout << p - q << "\n" << q - r;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int initial[n];
int first[n - 1];
int second[n - 2];
int sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 0; i < n; i++) {
cin >> initial[i];
sum1 += initial[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> first[i];
sum2 += first[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> second[i];
sum3 += second[i];
}
cout << (sum1 - sum2) << endl;
cout << (sum2 - sum3) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int a[3] = {0, 0, 0}, n, temp;
cin >> n;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < n - i; ++j) {
cin >> temp;
a[i] += temp;
}
}
cout << a[0] - a[1] << endl << a[1] - a[2] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int ONE, TWO, THREE;
cin >> n;
ONE = 0;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
ONE = ONE ^ c;
}
TWO = 0;
for (int i = 0; i < n - 1; i++) {
int c;
cin >> c;
TWO = TWO ^ c;
}
THREE = 0;
for (int i = 0; i < n - 2; i++) {
int c;
cin >> c;
THREE = THREE ^ c;
}
cout << (ONE ^ TWO) << endl;
cout << (TWO ^ THREE) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> first(n);
vector<int> second(n - 1);
vector<int> third(n - 2);
for (int i = 0; i < n; i++) {
cin >> first[i];
}
sort(first.begin(), first.end());
for (int i = 0; i < n - 1; i++) {
cin >> second[i];
}
sort(second.begin(), second.end());
for (int i = 0; i < n - 2; i++) {
cin >> third[i];
}
sort(third.begin(), third.end());
bool found = false;
for (int i = 0; i < n - 1; i++) {
if (first[i] != second[i]) {
if (second[i] == first[i + 1]) {
cout << first[i] << endl;
} else {
cout << second[i] << endl;
}
found = true;
break;
}
}
if (!found) {
if (first[n - 1] != second[n - 2]) {
cout << first[n - 1] << endl;
} else {
cout << second[n - 2] << endl;
}
}
found = false;
for (int i = 0; i < n - 2; i++) {
if (third[i] != second[i]) {
if (third[i] == second[i + 1]) {
cout << second[i];
} else {
cout << third[i];
}
found = true;
break;
}
}
if (!found) {
if (second[n - 2] != third[n - 3]) {
cout << second[n - 2];
} else {
cout << third[n - 3];
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, i, sum1 = 0, sum2 = 0, sum3 = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
sum1 = sum1 + a;
}
for (i = 0; i < n - 1; i++) {
cin >> a;
sum2 = sum2 + a;
}
for (i = 0; i < n - 2; i++) {
cin >> a;
sum3 = sum3 + a;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long int a[n];
map<long long int, long long int> mp;
for (int i = 0; i < n; i++) {
cin >> a[i];
mp[a[i]]++;
}
long long int b[n - 1];
map<long long int, long long int> mp_2;
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
mp_2[b[i]]++;
}
for (auto it : mp) {
if (it.second != mp_2[it.first]) {
cout << it.first << endl;
break;
}
}
long long int c[n - 2];
map<long long int, long long int> mp_3;
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
mp_3[c[i]]++;
}
for (auto it : mp_2) {
if (it.second != mp_3[it.first]) {
cout << it.first << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
multiset<int> s;
multiset<int> s1;
multiset<int> s2;
multiset<int> s3;
multiset<int> s4;
int main() {
int n, x;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
s.insert(x);
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
s1.insert(x);
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
s2.insert(x);
}
for (auto j : s1) {
s.erase(s.find(j));
}
for (auto j : s2) {
s1.erase(s1.find(j));
}
for (auto i : s) {
cout << i << '\n';
}
for (auto i : s1) {
cout << i << '\n';
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long n;
scanf("%lld", &n);
long long int a[n], a1[n - 1], a2[n - 2], i, sum = 0, sum1 = 0, sum2 = 0;
for (i = 0; i < n; i++) {
scanf("%lld", &a[i]);
sum += a[i];
}
for (i = 0; i < n - 1; i++) {
scanf("%lld", &a1[i]);
sum1 += a1[i];
}
for (i = 0; i < n - 2; i++) {
scanf("%lld", &a2[i]);
sum2 += a2[i];
}
printf("%d\n", sum - sum1);
printf("%d\n", sum1 - sum2);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, x;
cin >> n;
vector<int> a, b, c;
for (i = 0; i < n; i++) {
cin >> x;
a.push_back(x);
}
sort(a.begin(), a.end());
for (i = 1; i < n; i++) {
cin >> x;
b.push_back(x);
}
sort(b.begin(), b.end());
for (i = 0; i < n - 1; i++) {
if (a[i] != b[i]) break;
}
cout << a[i] << endl;
for (i = 2; i < n; i++) {
cin >> x;
c.push_back(x);
}
sort(c.begin(), c.end());
for (i = 0; i < n - 2; i++) {
if (b[i] != c[i]) break;
}
cout << b[i];
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long s1 = 0, s2 = 0, s3 = 0, num;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num;
s1 += num;
}
for (int i = 1; i < n; i++) {
cin >> num;
s2 += num;
}
for (int i = 2; i < n; i++) {
cin >> num;
s3 += num;
}
cout << s1 - s2 << endl;
cout << s2 - s3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum1 = 0, sum2 = 0, x;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
sum1 = sum1 + x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
sum2 = sum2 + x;
}
cout << sum1 - sum2 << endl;
sum1 = 0;
for (int i = 0; i < n - 2; i++) {
cin >> x;
sum1 = sum1 + x;
}
cout << sum2 - sum1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, m, p, q, r, x, y;
cin >> n;
vector<int> a, b, c;
for (i = 0; i < n; i++) {
cin >> p;
a.push_back(p);
}
for (i = 0; i < n - 1; i++) {
cin >> q;
b.push_back(q);
}
for (i = 0; i < n - 2; i++) {
cin >> r;
c.push_back(r);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
for (i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
y = b[i];
break;
}
}
for (i = 0; i < n; i++) {
if (b[i] != a[i]) {
x = a[i];
break;
}
}
cout << x << endl << y << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long n, x = 0, y = 0, z = 0, xx;
cin >> n;
for (long i = 1; i <= n; i++) {
cin >> xx;
x += xx;
}
for (long i = 1; i <= n - 1; i++) {
cin >> xx;
y += xx;
}
for (long i = 1; i <= n - 2; i++) {
cin >> xx;
z += xx;
}
cout << x - y << endl << y - z;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int ar[100005];
int ar1[100005];
int ar2[100005];
int main() {
int a, b, c, d, i, j, k, l, n;
cin >> n;
for (i = 0; i < n; i++) cin >> ar[i];
for (j = 0; j < n - 1; j++) cin >> ar1[j];
for (k = 0; k < n - 2; k++) cin >> ar2[k];
sort(ar, ar + n);
sort(ar1, ar1 + (n - 1));
sort(ar2, ar2 + (n - 2));
for (i = 0; i < n; i++) {
if (ar[i] != ar1[i]) {
cout << ar[i] << endl;
break;
}
}
for (i = 0; i < n - 1; i++) {
if (ar1[i] != ar2[i]) {
cout << ar1[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double epsilon = 1e-7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int err;
long long sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 0; i < n; i++) {
cin >> err;
sum1 += err;
}
for (int i = 0; i < n - 1; i++) {
cin >> err;
sum2 += err;
}
for (int i = 0; i < n - 2; i++) {
cin >> err;
sum3 += err;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void file() {}
const int MN = 1e9 + 1e2;
const int MW = 1e3 + 5;
const int OO = 1e9 + 5;
int main() {
file();
int n, x, sm[3]{0};
scanf("%d", &n);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < n - i and scanf("%d", &x); sm[i] += x, ++j)
;
printf("%d", sm[0] - sm[1]), printf("\n"), printf("%d", sm[1] - sm[2]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, i, ar[100005], a[100005], h[100005], q, sum1, sum2, sum3;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &ar[i]), sum1 += ar[i];
for (int i = 1; i < n; i++) scanf("%d", &ar[i]), sum2 += ar[i];
for (int i = 1; i < n - 1; i++) scanf("%d", &ar[i]), sum3 += ar[i];
printf("%d\n%d", sum1 - sum2, sum2 - sum3);
}
|
#include <bits/stdc++.h>
int main() {
int n, i, j, k, a[100000], b[100000], c[100000], d, s, S, x = 0, y = 0, z = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
x = x + a[i];
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &b[i]);
y = y + b[i];
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &c[i]);
z = z + c[i];
}
s = x - y;
S = y - z;
printf("%d\n %d\n", s, S);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> mymap1, mymap2, mymap3;
int main() {
int n;
scanf("%d", &n);
int x;
for (int i = 0; i < n; i++) {
scanf("%d", &x);
mymap1[x] += 1;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &x);
mymap2[x] += 1;
}
for (std::map<int, int>::iterator it = mymap1.begin(); it != mymap1.end();
++it) {
if (mymap2.find(it->first) == mymap2.end() ||
mymap2[it->first] < it->second) {
cout << it->first << endl;
break;
}
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &x);
mymap3[x] += 1;
}
for (std::map<int, int>::iterator it = mymap2.begin(); it != mymap2.end();
++it) {
if (mymap3.find(it->first) == mymap3.end() ||
mymap3[it->first] < it->second) {
cout << it->first << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a = 0, b = 0, c = 0, d;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> d;
a += d;
}
for (int i = 0; i < n - 1; i++) {
cin >> d;
b += d;
}
cout << a - b << endl;
for (int i = 0; i < n - 2; i++) {
cin >> d;
c += d;
}
cout << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, j = 0;
cin >> n;
long long int a[n], b[n - 1], c[n - 2], d = 0, e = 0, f = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
d += a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
e += b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
f += c[i];
}
cout << d - e << endl;
cout << e - f << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
int main() {
vector<int> v1, v2, v3;
scanf("%d", &n);
for (int i = 1, a; i <= n; ++i) {
scanf("%d", &a);
v1.push_back(a);
}
for (int i = 1, a; i <= n - 1; ++i) {
scanf("%d", &a);
v2.push_back(a);
}
for (int i = 1, a; i <= n - 2; ++i) {
scanf("%d", &a);
v3.push_back(a);
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
sort(v3.begin(), v3.end());
for (int i = 0; i < n; ++i)
if (i < n - 1) {
if (v1[i] != v2[i]) {
printf("%d\n", v1[i]);
break;
}
} else
printf("%d\n", v1[i]);
for (int i = 0; i < n - 1; ++i)
if (i < n - 2) {
if (v2[i] != v3[i]) {
printf("%d\n", v2[i]);
break;
}
} else
printf("%d\n", v2[i]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
struct _ {
_() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin.exceptions(istream::failbit | istream::badbit);
}
} _;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
template <class T, class second>
void smax(T& a, const second& b) {
if (b > a) a = b;
}
template <class T, class second>
void smin(T& a, const second& b) {
if (b < a) a = b;
}
template <class T, class second>
T pop_begin(second& a) {
auto it = a.begin();
T ret = *it;
a.erase(it);
return ret;
}
signed main() {
int N;
cin >> N;
unsigned int A = 0, B = 0;
for (int i = 0; i < (N); ++i) {
unsigned int x;
cin >> x;
A += x;
}
for (int i = 0; i < (N - 1); ++i) {
unsigned int x;
cin >> x;
A -= x;
B += x;
}
for (int i = 0; i < (N - 2); ++i) {
unsigned int x;
cin >> x;
B -= x;
}
cout << A << ' ' << B << endl;
}
|
#include <bits/stdc++.h>
template <class T>
bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0;
}
using namespace std;
using namespace chrono;
void solve() {
int64_t n;
cin >> n;
map<int64_t, int64_t> arr;
for (int64_t i = 0; i < n; ++i) {
int64_t a;
cin >> a;
arr[a]++;
}
map<int64_t, int64_t> temp = arr;
arr.clear();
for (int64_t i = 0; i < n - 1; ++i) {
int64_t a;
cin >> a;
temp[a]--;
arr[a]++;
}
for (auto i : temp) {
if (i.second > 0) {
cout << i.first << '\n';
break;
}
}
temp = arr;
for (int64_t i = 0; i < n - 2; ++i) {
int64_t a;
cin >> a;
temp[a]--;
}
for (auto x : temp) {
if (x.second > 0) {
cout << x.first << '\n';
break;
}
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
auto start1 = high_resolution_clock::now();
int64_t t = 1;
while (t--) {
solve();
}
auto stop1 = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop1 - start1);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
inline int get_Int() {
int x;
scanf("%d", &x);
return x;
}
inline string get_String() {
string x;
cin >> x;
return x;
}
map<int, bool> mark1, mark2, mark3;
int main() {
int n;
cin >> n;
int list[3][n];
for (int i = 0; i < n; i++) list[0][i] = get_Int();
for (int i = 0; i < n - 1; i++) list[1][i] = get_Int();
for (int i = 0; i < n - 2; i++) list[2][i] = get_Int();
sort(list[0], list[0] + n);
sort(list[1], list[1] + n - 1);
sort(list[2], list[2] + n - 2);
for (int i = 0; i < n - 1; i++) {
if (list[0][i] != list[1][i]) {
cout << list[0][i] << endl;
break;
}
if (i == n - 2) {
cout << list[0][n - 1] << endl;
break;
}
}
for (int i = 0; i < n - 2; i++) {
if (list[1][i] != list[2][i]) {
cout << list[1][i] << endl;
break;
} else if (i == n - 3) {
cout << list[1][n - 2] << endl;
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, temp;
cin >> n;
long long int sum = 0, sum2 = 0;
for (int i = 0; i < n; i++) {
cin >> temp;
sum += temp;
}
for (int i = 0; i < n - 1; i++) {
cin >> temp;
sum2 += temp;
}
cout << sum - sum2 << endl;
sum = 0;
for (int i = 0; i < n - 2; i++) {
cin >> temp;
sum += temp;
}
cout << sum2 - sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100000], b[100000], c[100000];
int get_ans_ab() {
map<int, int> cou_a;
for (int i = 0; i < n; i++) {
cou_a[a[i]]++;
}
map<int, int> cou_b;
for (int i = 0; i < n - 1; i++) {
cou_b[b[i]]++;
}
for (int i = 0; i < n; i++) {
if (cou_a[a[i]] > cou_b[a[i]]) {
return a[i];
}
}
}
int get_ans_bc() {
map<int, int> cou_b;
for (int i = 0; i < n - 1; i++) {
cou_b[b[i]]++;
}
map<int, int> cou_c;
for (int i = 0; i < n - 2; i++) {
cou_c[c[i]]++;
}
for (int i = 0; i < n - 1; i++) {
if (cou_b[b[i]] > cou_c[b[i]]) {
return b[i];
}
}
}
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &b[i]);
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &c[i]);
}
printf("%d\n%d\n", get_ans_ab(), get_ans_bc());
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int x = 1;
int ans;
int a, b;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
vector<int> vc1(n);
vector<int> vc2(n - 1);
vector<int> vc3(n - 2);
for (int i = 0; i < n; i++) cin >> vc1[i];
for (int i = 0; i < n - 1; i++) cin >> vc2[i];
for (int i = 0; i < n - 2; i++) cin >> vc3[i];
sort(vc1.begin(), vc1.end());
sort(vc2.begin(), vc2.end());
sort(vc3.begin(), vc3.end());
for (int i = 0; i < n - 1; i++) {
if (vc2[i] != vc1[i]) {
a = vc1[i];
break;
}
}
if (a == 0) a = vc1[n - 1];
for (int i = 0; i < n - 2; i++) {
if (vc3[i] != vc2[i]) {
b = vc2[i];
break;
}
}
if (b == 0) b = vc2[n - 2];
cout << a << endl << b;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long int n, i, j;
cin >> n;
long long int a[n], b[n - 1], c[n - 2];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (j = 0; j < n - 2; j++) {
cin >> c[j];
}
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
goto x;
}
}
cout << a[n - 1] << endl;
x:;
for (i = 0; i < n - 2; i++) {
if (c[i] != b[i]) {
cout << b[i] << endl;
goto y;
}
}
cout << b[n - 2] << endl;
;
y:;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
long s = 0, t = 0, tt = 0, a;
for (__typeof(n) i = 0; i < (n); i++) {
cin >> a;
s += a;
}
for (__typeof(n - 1) i = 0; i < (n - 1); i++) {
cin >> a;
t += a;
}
for (__typeof(n - 2) i = 0; i < (n - 2); i++) {
cin >> a;
tt += a;
}
cout << s - t << "\n" << t - tt << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
const int MAXN = 100000;
int arr1[MAXN], arr2[MAXN], arr3[MAXN];
map<int, int> map1;
map<int, int> map2;
map<int, int>::iterator it;
for (int i = 0; i < n; ++i) {
cin >> arr1[i];
it = map1.find(arr1[i]);
if (it == map1.end()) {
map1[arr1[i]] = 1;
} else {
it->second += 1;
}
}
for (int i = 0; i < n - 1; ++i) {
cin >> arr2[i];
it = map2.find(arr2[i]);
if (it == map2.end()) {
map2[arr2[i]] = 1;
} else {
it->second += 1;
}
it = map1.find(arr2[i]);
if (it != map1.end()) {
it->second -= 1;
}
}
for (int i = 0; i < n - 2; ++i) {
cin >> arr3[i];
it = map2.find(arr3[i]);
if (it != map2.end()) {
it->second -= 1;
}
}
for (int i = 0; i < n; ++i) {
it = map1.find(arr1[i]);
if (it->second != 0) {
cout << it->first << endl;
it->second -= 1;
}
}
for (int i = 0; i < n - 1; ++i) {
it = map2.find(arr2[i]);
if (it->second != 0) {
cout << it->first << endl;
it->second -= 1;
}
}
return 0;
}
|
#include <bits/stdc++.h>
int a[100050];
int b[100050];
int c[100050];
int main() {
int N, i;
scanf("%d", &N);
for (i = 1; i <= N; i++) scanf("%d", &a[i]);
for (i = 1; i <= N - 1; i++) scanf("%d", &b[i]);
for (i = 1; i <= N - 2; i++) scanf("%d", &c[i]);
std::sort(a + 1, a + N + 1);
std::sort(b + 1, b + N);
std::sort(c + 1, c + N - 1);
for (i = 1; i <= N - 1; i++) {
if (a[i] != b[i]) break;
}
printf("%d\n", a[i]);
for (i = 1; i <= N - 2; i++) {
if (b[i] != c[i]) break;
}
printf("%d\n", b[i]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e5 + 20;
int n, a[MXN], b[MXN], c[MXN];
vector<int> ans;
void IN() {
int tmp;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> tmp;
a[i] = tmp;
}
for (int i = 0; i < n - 1; i++) {
cin >> tmp;
b[i] = tmp;
}
for (int i = 0; i < n - 2; i++) {
cin >> tmp;
c[i] = tmp;
}
}
void SLV() {
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n; i++)
if (b[i] != a[i]) {
ans.push_back(a[i]);
break;
}
for (int i = 0; i < n; i++)
if (c[i] != b[i]) {
ans.push_back(b[i]);
break;
}
}
void OUT() {
for (auto i : ans) cout << i << endl;
}
int main() {
IN();
SLV();
OUT();
return 0;
}
|
#include <bits/stdc++.h>
long long int arr[100002], arr2[100002];
int cmpfunc(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main() {
long long int n, i, x;
scanf("%I64d", &n);
for (i = 0; i < n; i++) scanf("%I64d", &arr[i]);
for (i = 0; i < n - 1; i++) scanf("%I64d", &arr2[i]);
qsort(arr, n, sizeof(long long int), cmpfunc);
qsort(arr2, n - 1, sizeof(long long int), cmpfunc);
x = 0;
for (i = 0; i < n - 1; i++) {
if (arr[i] != arr2[i]) {
x = arr[i];
break;
}
}
if (x == 0) x = arr[n - 1];
printf("%I64d\n", x);
for (i = 0; i < n - 2; i++) scanf("%I64d", &arr[i]);
qsort(arr, n - 2, sizeof(long long int), cmpfunc);
x = 0;
for (i = 0; i < n - 2; i++) {
if (arr[i] != arr2[i]) {
x = arr2[i];
break;
}
}
if (x == 0) x = arr2[n - 2];
printf("%I64d\n", x);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
long long int res = 1;
x = x % 1000000007;
while (y > 0) {
if (y & 1) res = (res * x) % 1000000007;
y = y >> 1;
x = (x * x) % 1000000007;
}
return res;
}
long long int prime(long long int x) {
for (long long int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) return 0;
}
return 1;
}
long long int binary(long long int a[], long long int n, long long int k) {
long long int low = 0, mid = n / 2, high = n - 1;
while (low <= high) {
if (k < a[mid]) {
high = mid - 1;
} else if (k > a[mid]) {
low = mid + 1;
} else {
return mid + 1;
}
mid = (high + low) / 2;
}
return -1;
}
long long int sign(long long int x) { return x > 0; }
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
long long int t = 1;
while (t--) {
long long int n = 0, i = 0, j = 0, c = 0, k = 0, x = 0, y = 0, z = 0,
flag = 0, flag1 = 0;
cin >> n;
for (long long int i = 0; i < n; i++) {
cin >> k;
x += k;
}
for (long long int i = 0; i < n - 1; i++) {
cin >> k;
y += k;
}
for (long long int i = 0; i < n - 2; i++) {
cin >> k;
z += k;
}
cout << x - y << endl << y - z << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, j, k, sum1 = 0, sum2 = 0, sum3 = 0, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &k);
sum1 = sum1 + k;
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &k);
sum2 = sum2 + k;
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &k);
sum3 = sum3 + k;
}
printf("%d\n%d", (sum1 - sum2), (sum2 - sum3));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100007;
int a[MAX], b[MAX], c[MAX];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n - 1; ++i) cin >> b[i];
for (int i = 0; i < n - 2; ++i) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n - 1; ++i) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
if (i == n - 2) {
cout << a[n - 1] << endl;
}
}
for (int i = 0; i < n - 2; ++i) {
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
if (i == n - 3) {
cout << b[n - 2] << endl;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
int a[n], b[n - 1], c[n - 2], i;
for (i = 0; i < n; i++) cin >> a[i];
for (i = 0; i < n - 1; i++) cin >> b[i];
for (i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << "\n";
break;
}
}
for (i = 0; i < n - 1; i++)
if (b[i] != c[i]) {
cout << b[i];
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005], b[100005], c[100005];
void read() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
for (int i = 1; i < n; i++) scanf("%d", &b[i]);
for (int i = 1; i < n - 1; i++) scanf("%d", &c[i]);
}
void solve() {
sort(a + 1, a + n + 1);
sort(b + 1, b + n);
sort(c + 1, c + n - 1);
int i;
for (i = 1; i < n; i++)
if (a[i] != b[i]) {
printf("%d\n", a[i]);
break;
}
if (i == n) printf("%d\n", a[n]);
for (i = 1; i < n - 1; i++)
if (b[i] != c[i]) {
printf("%d\n", b[i]);
break;
}
if (i == n - 1) printf("%d\n", b[n - 1]);
}
int main() {
read();
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void fast() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
inline int D() {
int m;
cin >> m;
return m;
}
inline long long lD() {
long long m;
cin >> m;
return m;
}
inline double dD() {
double m;
cin >> m;
return m;
}
int arr1[1000006], arr2[1000006], arr3[1000006];
int main() {
fast();
int n = D();
for (int i = 0; i < n; ++i) {
cin >> arr1[i];
}
for (int i = 0; i < n - 1; ++i) cin >> arr2[i];
for (int i = 0; i < n - 2; ++i) cin >> arr3[i];
sort(arr1, arr1 + n);
sort(arr2, arr2 + n - 1);
sort(arr3, arr3 + n - 2);
bool f = true;
for (int i = 0; i < n - 1; ++i) {
if (arr1[i] != arr2[i]) {
cout << arr1[i] << "\n";
f = false;
break;
}
}
if (f)
cout << arr1[n - 1] << "\n";
else
f = true;
for (int i = 0; i < n - 2; ++i) {
if (arr2[i] != arr3[i]) {
cout << arr2[i] << "\n";
f = false;
break;
}
}
if (f) cout << arr2[n - 2] << "\n";
}
|
#include <bits/stdc++.h>
int find(long long *dic, long long vl, int size) {
int first = 0, last = size;
while (first < last) {
int m = first + (last - first) / 2;
if (dic[m] >= vl)
last = m;
else
first = m + 1;
}
return dic[last] == vl ? last : -1;
}
int main() {
long long n, dic[100001], s[100001], temp;
long long zip[100001], pos = 0, k;
int flag[100001];
scanf("%ld64", &n);
for (int i = 0; i < n; i++) {
scanf("%ld64", &dic[i]);
s[i] = 0;
}
std::sort(dic, dic + n);
temp = dic[0];
zip[0] = temp;
s[0] = 1;
for (int i = 1; i < n; i++) {
if (dic[i] == temp)
s[pos]++;
else {
s[++pos] = 1;
temp = dic[i];
zip[pos] = temp;
}
}
long long mm[100001];
for (int i = 0; i < n - 1; i++) {
scanf("%ld64", &k);
int ind = find(zip, k, pos);
mm[ind] += k;
flag[ind] = 1;
}
int in = -1;
for (int i = 0; i < pos + 1; i++) {
if (mm[i] / s[i] != zip[i]) {
printf("%d\n", zip[i]);
in = i;
break;
}
}
for (int i = 0; i < n - 2; i++) {
scanf("%ld64", &k);
int ind = find(zip, k, pos);
mm[ind] += k;
flag[ind] = 2;
}
bool des = false;
for (int i = 0; i < pos + 1; i++) {
if (in == i) continue;
if ((mm[i] / 2) / s[i] != zip[i]) {
printf("%d\n", zip[i]);
des = true;
break;
}
}
if (!des) printf("%d\n", zip[in]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (int i = 0; i < n; ++i) cin >> a[i];
b[n - 1] = 1e9 + 4;
c[n - 2] = 1e9 + 4;
for (int i = 0; i < n - 1; ++i) cin >> b[i];
for (int i = 0; i < n - 2; ++i) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0;; ++i)
if (a[i] != b[i]) {
cout << a[i] << " ";
break;
} else
cerr << "P";
for (int i = 0;; ++i)
if (b[i] != c[i]) {
cout << b[i];
break;
} else
cerr << "O";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> nums(n);
vector<int> numt(n - 1);
vector<int> numf(n - 2);
for (int i = 0; i < n; i++) {
int t;
cin >> t;
nums.push_back(t);
}
for (int i = 0; i < n - 1; i++) {
int t;
cin >> t;
numt.push_back(t);
}
for (int i = 0; i < n - 2; i++) {
int t;
cin >> t;
numf.push_back(t);
}
bool b = false;
sort(nums.begin(), nums.end(), greater<int>());
sort(numt.begin(), numt.end(), greater<int>());
sort(numf.begin(), numf.end(), greater<int>());
for (int i = 0; i < n - 1; i++) {
if (nums[i] == numt[i]) {
nums[i] = 0;
}
}
sort(nums.begin(), nums.end(), greater<int>());
cout << nums[0] << endl;
for (int i = 0; i < n - 1; i++) {
if (numt[i] == numf[i]) {
numt[i] = 0;
numf[i] = 0;
}
}
sort(nums.begin(), nums.end(), greater<int>());
sort(numt.begin(), numt.end(), greater<int>());
sort(numf.begin(), numf.end(), greater<int>());
cout << numt[0] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<long long int> vec1, vec2;
vector<long long int>::iterator it;
long long int n, a, sz, s1 = 0, s2 = 0, s3 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s1 += a;
}
n--;
for (int i = 0; i < n; i++) {
cin >> a;
s2 += a;
}
n--;
for (int i = 0; i < n; i++) {
cin >> a;
s3 += a;
}
cout << s1 - s2 << endl << s2 - s3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
int sum1 = 0;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
sum1 += a;
}
int sum2 = 0;
for (int i = 1; i < n; ++i) {
int a;
cin >> a;
sum2 = sum2 + a;
}
int sum3 = 0;
for (int i = 2; i < n; ++i) {
int a;
cin >> a;
sum3 += a;
}
cout << sum1 - sum2 << endl << sum2 - sum3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
sort(a.begin(), a.end());
vector<int> b(n - 1);
for (int i = 0; i < n - 1; ++i) cin >> b[i];
sort(b.begin(), b.end());
bool f = false;
for (int i = 0; i < n - 1; ++i) {
if (b[i] != a[i]) {
cout << a[i] << endl;
a.erase(a.begin() + i);
f = true;
break;
}
}
if (!f) {
cout << a[n - 1] << endl;
a.erase(a.begin() + n - 1);
}
vector<int> c(n - 2);
for (int i = 0; i < n - 2; ++i) cin >> c[i];
sort(c.begin(), c.end());
f = false;
for (int i = 0; i < n - 2; ++i) {
if (c[i] != a[i]) {
cout << a[i] << endl;
f = true;
break;
}
}
if (!f) {
cout << a[n - 2] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void solve(std::istream& in, std::ostream& out) {
map<int, int> a, b, c;
int n;
in >> n;
int m;
for (int i = 0; i < n; ++i) {
in >> m;
a[m]++;
}
for (int i = 0; i < n - 1; ++i) {
in >> m;
b[m]++;
}
for (int i = 0; i < n - 2; ++i) {
in >> m;
c[m]++;
}
out << minus(a, b) << endl << minus(b, c) << endl;
}
int minus(map<int, int>& a, map<int, int>& b) {
for (auto i : a)
if (b[i.first] < i.second) return i.first;
return 0;
}
};
void solve(std::istream& in, std::ostream& out) {
out << std::setprecision(12);
Solution solution;
solution.solve(in, out);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
istream& in = cin;
ostream& out = cout;
solve(in, out);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long suma = 0, sumb = 0, sumc = 0, x;
for (long long i = 0; i < n; i++) cin >> x, suma += x;
for (long long i = 0; i < n - 1; i++) cin >> x, sumb += x;
for (long long i = 0; i < n - 2; i++) cin >> x, sumc += x;
cout << suma - sumb << endl << sumb - sumc;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v1, v2, v3;
int n, a;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
v1.push_back(a);
}
sort(v1.begin(), v1.end());
for (int i = 0; i < n - 1; i++) {
cin >> a;
v2.push_back(a);
}
sort(v2.begin(), v2.end());
for (int i = 0; i < n - 2; i++) {
cin >> a;
v3.push_back(a);
}
sort(v3.begin(), v3.end());
for (int i = 0; i < n; i++) {
if (v1[i] != v2[i]) {
cout << v1[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (v2[i] != v3[i]) {
cout << v2[i] << endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
map<int, int> ma1;
map<int, int> ma2;
ma1.clear();
ma2.clear();
map<int, int>::iterator it;
int n, i, x;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
ma1[x]++;
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &x);
ma1[x]--;
ma2[x]++;
}
for (it = ma1.begin(); it != ma1.end(); it++) {
if (it->second == 1) {
printf("%d\n", it->first);
break;
}
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &x);
ma2[x]--;
}
int flag = 0;
for (it = ma2.begin(); it != ma2.end(); it++) {
if (it->second == 1) {
printf("%d\n", it->first);
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long int> a(n), b(n), c(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
int k1, k2;
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) k1 = a[i];
if (b[i] != c[i]) k2 = b[i];
}
cout << k1 << endl << k2;
return 0;
}
|
#include <bits/stdc++.h>
int main(void) {
int i, j, n, x;
long long sums[3] = {0};
scanf("%d", &n);
for (i = 0; i < sizeof sums / sizeof *sums; ++i) {
for (j = 0; j < n - i; ++j) {
scanf("%d", &x);
sums[i] += x;
}
}
for (i = 1; i < sizeof sums / sizeof *sums; ++i) {
printf("%d\n", sums[i - 1] - sums[i]);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
multiset<int> rec, tem;
int main() {
std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
start = std::chrono::high_resolution_clock::now();
int n, ans1, ans2;
cin >> n;
for (int(i) = (0); (i) < (n); ++(i)) {
int c;
cin >> c;
rec.insert(c);
tem.insert(c);
}
for (int(i) = (0); (i) < (n - 1); ++(i)) {
int c;
cin >> c;
auto it = rec.find(c);
rec.erase(it);
}
ans1 = *rec.begin();
auto it = tem.find(ans1);
tem.erase(it);
for (int(i) = (0); (i) < (n - 2); ++(i)) {
int c;
cin >> c;
auto it = tem.find(c);
tem.erase(it);
}
ans2 = *tem.begin();
cout << ans1 << endl << ans2 << endl;
end = std::chrono::high_resolution_clock::now();
long long elapsed_time =
std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int n, a[100000], b[1000000], c[100000], x = 0, y = 0, z = 0;
int main() {
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
x ^= a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
y ^= b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
z ^= c[i];
}
cout << (x ^ y) << endl << (y ^ z);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, flag1 = 0, flag2 = 0, x, y;
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n - 1; ++i) cin >> b[i];
for (int i = 0; i < n - 2; ++i) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n - 1; ++i) {
if (a[i] != b[i]) {
flag1 = 1;
x = a[i];
break;
}
}
for (int i = 0; i < n - 2; ++i) {
if (b[i] != c[i]) {
flag2 = 1;
y = b[i];
break;
}
}
if (flag1 == 0) x = a[n - 1];
if (flag2 == 0) y = b[n - 2];
cout << x << endl << y;
}
|
#include <bits/stdc++.h>
int main() {
long long a = 0, b = 0, c = 0;
int temp, n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &temp);
a += temp;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &temp);
b += temp;
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &temp);
c += temp;
}
printf("%lld\n%lld", a - b, b - c);
return 0;
}
|
#include <bits/stdc++.h>
double const EPS = 3e-8;
using namespace std;
template <class T>
T gcd(T a, T b) {
return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
return (a / gcd<T>(a, b) * b);
}
template <class T>
inline bool read(T &x) {
int c = getchar();
int sgn = 1;
while (~c && c < '0' || c > '9') {
if (c == '-') sgn = -1;
c = getchar();
}
for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
x *= sgn;
return ~c;
}
const int MX = 1e5 + 10;
int inp[3][MX];
int main() {
map<int, int> ID, prst;
int n = ({
int a;
read(a);
a;
});
for (__typeof((n)-1) i = (0); i <= (n)-1; ++i) {
inp[0][i] = ({
int a;
read(a);
a;
});
prst[inp[0][i]]++;
}
for (__typeof((n - 1) - 1) i = (0); i <= (n - 1) - 1; ++i) {
inp[1][i] = ({
int a;
read(a);
a;
});
prst[inp[1][i]]--;
}
for (__typeof((n)-1) i = (0); i <= (n)-1; ++i) {
if (prst[inp[0][i]] == 1) {
prst[inp[0][i]]--;
cout << inp[0][i] << endl;
break;
}
}
for (__typeof((n - 1) - 1) i = (0); i <= (n - 1) - 1; ++i) {
prst[inp[1][i]]++;
}
for (__typeof((n - 2) - 1) i = (0); i <= (n - 2) - 1; ++i) {
inp[2][i] = ({
int a;
read(a);
a;
});
prst[inp[2][i]]--;
}
for (__typeof((n - 1) - 1) i = (0); i <= (n - 1) - 1; ++i) {
if (prst[inp[1][i]] == 1) {
prst[inp[1][i]]--;
cout << inp[1][i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, arr[100005], arrS[3] = {0};
cin >> n;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < n; j++) {
cin >> arr[j];
arrS[i] += arr[j];
}
n--;
}
int x1 = arrS[0] - arrS[1];
int x2 = arrS[1] - arrS[2];
cout << x1 << "\n" << x2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[3], n, m;
int main() {
cin >> n;
for (int i = 0; i < 3; i++)
for (int j = 0; j < n - i; j++) cin >> m, a[i] += m;
cout << a[0] - a[1] << endl;
cout << a[1] - a[2];
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long n, i, a;
unsigned long long s1 = 0, s2 = 0, s3 = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
s1 += (unsigned long long)a;
}
for (i = 0; i < n - 1; i++) {
cin >> a;
s2 += (unsigned long long)a;
}
for (i = 0; i < n - 2; i++) {
cin >> a;
s3 += (unsigned long long)a;
}
cout << s1 - s2 << "\n" << s2 - s3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
const int maxn = 1e5 + 10;
int n;
scanf("%d", &n);
int x, sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 1; i <= n; i++) {
scanf("%d", &x);
sum1 += x;
}
for (int i = 1; i <= n - 1; i++) {
scanf("%d", &x);
sum2 += x;
}
for (int i = 1; i < n - 1; i++) {
scanf("%d", &x);
sum3 += x;
}
printf("%d\n%d\n", sum1 - sum2, sum2 - sum3);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
int arr2[n];
int arr3[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> arr2[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> arr3[i];
}
sort(arr, arr + n);
sort(arr2, arr2 + n - 1);
sort(arr3, arr3 + n - 2);
int count1 = 0;
int count2 = 0;
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr2[i]) {
cout << arr[i] << endl;
count1 = 1;
break;
}
}
if (count1 == 0) {
cout << arr[n - 1] << endl;
}
for (int i = 0; i < n - 2; i++) {
if (arr2[i] != arr3[i]) {
cout << arr2[i];
count2 = 1;
break;
}
}
if (count2 == 0) {
cout << arr2[n - 2];
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long tot1 = 0, tot2 = 0, tot3 = 0;
int temp = 0;
for (int i = 0; i < n; i++) {
cin >> temp;
tot1 += temp;
}
for (int i = 0; i < n - 1; i++) {
cin >> temp;
tot2 += temp;
}
for (int i = 0; i < n - 2; i++) {
cin >> temp;
tot3 += temp;
}
cout << tot1 - tot2 << endl;
cout << tot2 - tot3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
int a[n + 1];
int b[n];
int c[n - 1];
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n - 1; i++) cin >> b[i];
for (int i = 1; i <= n - 2; i++) cin >> c[i];
sort(a + 1, a + n + 1);
sort(b + 1, b + n);
sort(c + 1, c + n - 1);
for (int i = 1; i <= n; i++) {
if (i == n || (a[i] != b[i])) {
cout << a[i] << endl;
break;
}
}
for (int i = 1; i <= n - 1; i++) {
if (i == n - 1 || (b[i] != c[i])) {
cout << b[i] << endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int a[MAXN], b[MAXN], c[MAXN];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
for (int j = 0; j < n - 1; j++) cin >> b[j];
sort(b, b + n - 1);
for (int i = 0; i < n; i++)
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
for (int i = 0; i < n - 2; i++) cin >> c[i];
sort(c, c + n - 2);
for (int i = 0; i < n - 1; i++)
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int s[3] = {0};
int n, in;
cin >> n;
for (int i = 0; i < 3; i++) {
for (int j = i; j < n; j++) {
cin >> in;
s[i] += in;
}
}
cout << s[0] - s[1] << endl;
cout << s[1] - s[2] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int a[100000];
int b[100000];
int c[100000];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n - 1; i++) cin >> b[i];
for (int i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, x, y;
cin >> n;
long long a[n], b[n - 1], c[n - 2];
for (i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
for (i = 0; i < n - 1; i++) cin >> b[i];
sort(b, b + (n - 1));
for (i = 0; i < n - 2; i++) cin >> c[i];
sort(c, c + (n - 2));
for (i = 0; i < n; i++) {
if (a[i] != b[i]) {
x = a[i];
break;
}
}
for (i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
y = b[i];
break;
}
}
cout << x << endl;
cout << y << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ar[n], arr[n - 1], arrr[n - 2];
for (int i = 0; i < n; i++) cin >> ar[i];
for (int i = 0; i < n - 1; i++) cin >> arr[i];
for (int i = 0; i < n - 2; i++) cin >> arrr[i];
sort(ar, ar + n);
sort(arr, arr + n - 1);
sort(arrr, arrr + n - 2);
for (int i = 0; i < n; i++) {
if (i == n - 1) {
cout << ar[i] << endl;
break;
}
if (ar[i] != arr[i]) {
cout << ar[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (i == n - 2) {
cout << arr[i] << endl;
return 0;
}
if (arr[i] != arrr[i]) {
cout << arr[i] << endl;
return 0;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b, long long c) {
return min(a, min(b, c));
}
template <class T>
const T& max(const T& a, const T& b, const T& c) {
return max(a, max(b, c));
}
template <class T>
const T& min(const T& a, const T& b, const T& c) {
return min(a, min(b, c));
}
struct sp {
bool operator()(const pair<string, int>& a, const pair<string, int>& b) {
if (a.second != b.second) {
return (a.second > b.second);
}
return (a.first < b.first);
}
};
long long stoi(string& str) {
istringstream second(str);
long long i;
second >> i;
return i;
}
string itos(long long i) {
stringstream second;
second << i;
return second.str();
}
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int a[100001];
vector<int> v;
void dfs(long long i) {
if (i > pow(10, 9)) return;
if (i > 0) v.push_back(i);
dfs(i * 10 + 4);
dfs(i * 10 + 7);
}
int main() {
map<long long, long long> m1, m2, m3;
long long x;
long long n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
m1[x]++;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
m2[x]++;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
m3[x]++;
}
for (auto itr = m1.begin(); itr != m1.end(); ++itr)
if (itr->second != m2[itr->first]) {
cout << itr->first << endl;
break;
}
for (auto itr = m2.begin(); itr != m2.end(); ++itr)
if (itr->second != m3[itr->first]) {
cout << itr->first << endl;
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, x, a, b, c;
signed main() {
cin >> n;
for (long long i = 0; i < n; ++i) cin >> x, a += x;
for (long long i = 0; i < n - 1; ++i) cin >> x, b += x;
for (long long i = 0; i < n - 2; ++i) cin >> x, c += x;
cout << a - b << endl << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long i;
bool isPrime(long long n) {
if (n == 1) {
return false;
} else if (n == 2 || n == 3) {
return true;
} else {
for (i = 2; i <= sqrt(n); i++) {
if (n % i == 0) {
return false;
}
}
}
return true;
}
long long gcd(long long a, long long b) {
if (a == 0) {
return b;
} else {
return gcd(b % a, a);
}
}
long long lcm(long long a, long long b) {
return (max(a, b) / gcd(a, b)) * min(a, b);
}
int main() {
long long n;
cin >> n;
long long arr[n], brr[n - 1], crr[n - 2];
for (long long i = 0; i < n; i++) {
cin >> arr[i];
}
for (long long i = 0; i < n - 1; i++) {
cin >> brr[i];
}
for (long long i = 0; i < n - 2; i++) {
cin >> crr[i];
}
sort(arr, arr + n);
sort(brr, brr + (n - 1));
sort(crr, crr + (n - 2));
bool state1 = false, state2 = false;
for (long long i = 0; i < n - 1; i++) {
if (arr[i] != brr[i]) {
cout << arr[i] << endl;
state1 = true;
break;
}
}
if (!state1) {
cout << arr[n - 1] << endl;
}
for (long long i = 0; i < n - 2; i++) {
if (brr[i] != crr[i]) {
cout << brr[i] << endl;
state2 = true;
break;
}
}
if (!state2) {
cout << brr[n - 2] << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 1;
void solve() {
long long int n, m, k, p = 0, q = 0, s = 0, c = 0, i, j;
cin >> n;
map<int, int> m1, m2, m3;
for (long long int i = 0; i < n; i++) cin >> p, m1[p]++;
for (long long int i = 0; i < n - 1; i++) cin >> p, m3[p]++;
for (long long int i = 0; i < n - 2; i++) cin >> p, m2[p]++;
for (auto it : m3) {
m1[it.first] -= it.second;
}
for (auto it : m1)
if (it.second > 0) {
cout << it.first << "\n";
break;
}
for (auto it : m2) {
m3[it.first] -= it.second;
}
for (auto it : m3)
if (it.second > 0) {
cout << it.first << "\n";
break;
}
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, n, num1 = 0, num2 = 0;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &a);
num1 ^= a;
}
for (int i = 1; i <= n - 1; i++) {
scanf("%d", &a);
num1 ^= a;
num2 ^= a;
}
printf("%d\n", num1);
for (int i = 1; i <= n - 2; i++) {
scanf("%d", &a);
num2 ^= a;
}
printf("%d\n", num2);
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100010], b[100010], c[100010];
int main(int argc, char* argv[]) {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
for (int i = 0; i < n - 1; i++) scanf("%d", &b[i]);
sort(b, b + n - 1);
for (int i = 0; i < n - 2; i++) scanf("%d", &c[i]);
sort(c, c + n - 2);
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
printf("%d\n", a[i]);
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
printf("%d\n", b[i]);
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> m1, m2;
int a[100001];
int b[100001];
int main() {
ios_base::sync_with_stdio(false);
int n, val;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
m2[b[i]]++;
}
for (int i = 0; i < n - 2; i++) {
cin >> val;
m1[val]++;
}
int ans1, ans2;
for (int i = 0; i < n - 1; i++) {
if (m1[b[i]] == 0) {
ans1 = b[i];
} else
m1[b[i]]--;
}
for (int i = 0; i < n; i++) {
if (m2[a[i]] == 0) {
ans2 = a[i];
} else
m2[a[i]]--;
}
cout << ans2 << endl << ans1 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, flag1 = 0, flag2 = 0, x, y;
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n - 1; ++i) cin >> b[i];
for (int i = 0; i < n - 2; ++i) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n - 1; ++i) {
if (a[i] != b[i]) {
flag1 = 1;
x = a[i];
break;
}
}
for (int i = 0; i < n - 2; ++i) {
if (b[i] != c[i]) {
flag2 = 1;
y = b[i];
break;
}
}
if (flag1 == 0) x = a[n - 1];
if (flag2 == 0) y = b[n - 2];
cout << x << endl << y;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> errors[3];
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
errors[0].push_back(a);
}
for (int i = 0; i < n - 1; ++i) {
int a;
cin >> a;
errors[1].push_back(a);
}
for (int i = 0; i < n - 2; ++i) {
int a;
cin >> a;
errors[2].push_back(a);
}
sort(errors[0].begin(), errors[0].end());
sort(errors[1].begin(), errors[1].end());
sort(errors[2].begin(), errors[2].end());
int first, second;
int sub_i = 0;
for (int i = 0; i < n; ++i) {
if (sub_i == n - 1) {
first = errors[0][n - 1];
break;
}
if (errors[0][i] != errors[1][sub_i]) {
first = errors[0][i];
break;
} else {
++sub_i;
}
}
sub_i = 0;
for (int i = 0; i < n - 1; ++i) {
if (sub_i == n - 2) {
second = errors[1][n - 2];
break;
}
if (errors[1][i] != errors[2][sub_i]) {
second = errors[1][i];
break;
} else {
++sub_i;
}
}
cout << first << endl << second << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0, x = 0;
long long a = 0, b = 0, c = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
a += x;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &x);
b += x;
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &x);
c += x;
}
printf("%I64d\n%I64d\n", a - b, b - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long a[n], b[n - 1], c[n - 2], i, s1 = 0, s2 = 0, s3 = 0;
for (i = 0; i < n; ++i) {
cin >> a[i];
s1 += a[i];
}
for (i = 0; i < n - 1; ++i) {
cin >> b[i];
s2 += b[i];
}
for (i = 0; i < n - 2; ++i) {
cin >> c[i];
s3 += c[i];
}
cout << s1 - s2 << endl;
cout << s2 - s3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int v[n];
for (int i = 0; i < n; i++) {
cin >> v[i];
}
map<int, int> mp1;
map<int, int> mp2;
for (int i = 0; i < n - 1; i++) {
int a;
cin >> a;
mp1[a]++;
}
for (int i = 0; i < n - 2; i++) {
int b;
cin >> b;
mp2[b]++;
}
for (int i = 0; i < n; i++) {
if (mp1.find(v[i]) == mp1.end()) {
cout << v[i] << endl;
mp2[v[i]]++;
break;
} else {
mp1[v[i]]--;
if (mp1[v[i]] == 0) {
mp1.erase(v[i]);
}
}
}
for (int i = 0; i < n; i++) {
if (mp2.find(v[i]) == mp2.end()) {
cout << v[i] << endl;
break;
} else {
mp2[v[i]]--;
if (mp2[v[i]] == 0) {
mp2.erase(v[i]);
}
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5 + 5;
int a[nax];
int b[nax];
int c[nax];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a, a + n);
sort(b, b + (n - 1));
sort(c, c + (n - 2));
int f = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
f = 1;
cout << a[i] << endl;
break;
}
}
if (f == 0) {
cout << a[n - 1] << endl;
}
f = 0;
for (int i = 0; i < n - 2; i++) {
if (c[i] != b[i]) {
f = 1;
cout << b[i] << endl;
break;
}
}
if (f == 0) {
cout << b[n - 2] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
scanf("%d", &n);
int a = 0, b = 0, c = 0, x;
for (i = 0; i < n; i++) {
scanf("%d", &x);
a = a ^ x;
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &x);
b = b ^ x;
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &x);
c = c ^ x;
}
cout << (a ^ b) << endl << (b ^ c) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const long long INF = 1e9 + 7;
const long double EPS = 1e-9;
const long long P = 485437;
const int C = 2016;
int a[N], b[N], c[N];
void read(int n, int* a) {
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
}
int cmp(int* a, int* b, int n) {
for (int i = 0; i < n - 1; i++)
if (a[i] != b[i]) return a[i];
return a[n - 1];
}
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
read(n, a);
read(n - 1, b);
read(n - 2, c);
cout << cmp(a, b, n) << endl << cmp(b, c, n - 1) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int b[n - 1];
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
int c[n - 2];
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
bool bf = false;
for (int i = 0; i < n - 1; i++) {
if (a[i] == b[i])
continue;
else {
bf = true;
cout << a[i] << endl;
break;
}
}
if (!bf) {
cout << a[n - 1] << endl;
}
bool cf = false;
for (int i = 0; i < n - 2; i++) {
if (b[i] == c[i])
continue;
else {
cf = true;
cout << b[i] << endl;
break;
}
}
if (!cf) {
cout << b[n - 2] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
int n;
cin >> n;
int x, a1 = 0, a2 = 0, a3 = 0;
for (int i = 0; i < n; i++) cin >> x, a1 += x;
;
for (int i = 0; i < n - 1; i++) cin >> x, a2 += x;
;
cout << a1 - a2 << endl;
for (int i = 0; i < n - 2; i++) cin >> x, a3 += x;
;
cout << a2 - a3 << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.