text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long N;
scanf("%lld", &N);
vector<long long> a, b, c;
map<long long, long long> A, B, C;
for (long long n = 0; n < N; ++n) {
long long x;
scanf("%lld", &x);
a.push_back(x);
A[x] += 1;
}
for (long long n = 0; n < (N - 1); ++n) {
long long x;
scanf("%lld", &x);
b.push_back(x);
B[x] += 1;
}
for (long long n = 0; n < (N - 2); ++n) {
long long x;
scanf("%lld", &x);
c.push_back(x);
C[x] += 1;
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
long long Ans1 = -1, Ans2 = -1;
for (long long n = 0; n < N; ++n) {
if (B[a[n]] == 0) {
Ans1 = a[n];
break;
}
B[a[n]] -= 1;
}
for (long long n = 0; n < N - 1; ++n) {
if (C[b[n]] == 0) {
Ans2 = b[n];
break;
}
C[b[n]] -= 1;
}
cout << Ans1 << endl << Ans2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int main() {
int n, a[maxn], b[maxn], c[maxn];
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]);
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
int i;
b[n - 1] = -1;
for (i = 0; i < n; ++i)
if (a[i] != b[i]) break;
printf("%d\n", a[i]);
c[n - 2] = -1;
for (i = 0; i < n - 1; ++i)
if (c[i] != b[i]) break;
printf("%d\n", b[i]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long x, sum = 0, sum1 = 0, sum2 = 0, y;
cin >> x;
for (int i = 0; i < x; i++) {
cin >> y;
sum += y;
}
for (int i = 0; i < x - 1; i++) {
cin >> y;
sum1 += y;
}
for (int i = 0; i < x - 2; i++) {
cin >> y;
sum2 += y;
}
cout << sum - sum1 << endl;
cout << sum1 - sum2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp1, mp2, mp3;
int a[100005], b[100005], c[100005];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
mp1[a[i]]++;
}
for (int i = 0; i < n - 1; i++) {
int x;
cin >> b[i];
mp2[b[i]]++;
}
for (int i = 0; i < n - 2; i++) {
int x;
cin >> c[i];
mp3[c[i]]++;
}
for (int i = 0; i < n; i++) {
if (mp1[a[i]] > mp2[a[i]]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (mp2[b[i]] > mp3[b[i]]) {
cout << b[i] << endl;
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, sum, res;
sum = res = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
sum += a;
}
for (int i = 0; i < n - 1; i++) {
cin >> a;
res += a;
}
cout << sum - res << endl;
sum = 0;
for (int i = 0; i < n - 2; i++) {
cin >> a;
sum += a;
}
cout << res - sum << endl;
}
|
#include <bits/stdc++.h>
void readInt(int &n) {
char ch;
n = 0;
while (ch = getchar()) {
if (ch >= '0' && ch <= '9')
n = n * 10 + ch - 48;
else
break;
}
}
int main() {
int n, tmp;
int sum[3] = {0};
readInt(n);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < n - i; j++) {
readInt(tmp);
sum[i] ^= tmp;
}
}
printf("%d\n%d\n", sum[0] ^ sum[1], sum[1] ^ sum[2]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9 + 7;
const long double pi = acos(-1);
int n;
int main() {
ios::sync_with_stdio(false);
cin >> n;
long long int sum_0 = 0, sum_1 = 0, sum_2 = 0;
for (int i = 0; i < n; i++) {
long long int e;
cin >> e;
sum_0 += e;
}
for (int i = 0; i < n - 1; i++) {
long long int e;
cin >> e;
sum_1 += e;
}
for (int i = 0; i < n - 2; i++) {
long long int e;
cin >> e;
sum_2 += e;
}
cout << sum_0 - sum_1 << endl << sum_1 - sum_2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long n;
cin >> n;
vector<long long> V(n, 0), V1(n - 1, 0), V2(n - 2, 0);
for (long long i = 0; i < n; i++) {
cin >> V[i];
}
sort(V.begin(), V.end());
for (long long i = 0; i < n - 1; i++) {
cin >> V1[i];
}
sort(V1.begin(), V1.end());
for (long long i = 0; i < n - 2; i++) {
cin >> V2[i];
}
sort(V2.begin(), V2.end());
for (long long i = 0; i < n; i++) {
if (V[i] != V1[i]) {
cout << V[i] << endl;
break;
}
}
for (long long i = 0; i < n; i++) {
if (V1[i] != V2[i]) {
cout << V1[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, a[200000], b[200000], c[200000];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + 1 + n);
for (int i = 1; i < n; i++) {
cin >> b[i];
}
sort(b + 1, b + n);
b[n] = 999999999;
for (int i = 1; i < n - 1; i++) {
cin >> c[i];
}
sort(c + 1, c + n - 1);
c[n - 1] = 999999999;
for (int i = 1; i <= n; i++) {
if (a[i] != b[i]) {
cout << a[i] << "\n";
break;
}
}
for (int i = 1; i < n; i++) {
if (c[i] != b[i]) {
cout << b[i] << "\n";
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long oo = 1000000000000000000;
const int N = 100005;
int main() {
int n, x;
scanf("%d", &n);
multiset<int> a, b;
for (int i = 0; i < int(n); i++) {
scanf("%d", &x);
a.insert(x);
}
for (int i = 0; i < int(n - 1); i++) {
scanf("%d", &x);
b.insert(x);
a.erase(a.find(x));
}
printf("%d\n", *a.begin());
a.clear();
swap(a, b);
for (int i = 0; i < int(n - 2); i++) {
scanf("%d", &x);
b.insert(x);
a.erase(a.find(x));
}
printf("%d\n", *a.begin());
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
void solve1() {
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]);
}
void solve2() {
long long sumA = 0, sumB = 0, sumC = 0;
scanf("%d", &n);
for (int i = 1, a; i <= n; ++i) {
scanf("%d", &a);
sumA += a;
}
for (int i = 1, a; i <= n - 1; ++i) {
scanf("%d", &a);
sumB += a;
}
for (int i = 1, a; i <= n - 2; ++i) {
scanf("%d", &a);
sumC += a;
}
cout << sumA - sumB << '\n' << sumB - sumC;
}
int main() {
solve2();
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;
map<int, int> m, ma;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
m[x]++;
}
for (int i = 0; i < n - 1; ++i) {
int x;
cin >> x;
m[x]--, ma[x]++;
}
for (auto const &i : m) {
if (i.second != 0) cout << i.first << "\n";
}
for (int i = 0; i < n - 2; ++i) {
int x;
cin >> x;
ma[x]--;
}
for (auto const &i : ma) {
if (i.second != 0) cout << i.first << "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long long sum1 = 0, sum2 = 0, sum3 = 0;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
int x;
scanf("%d", &x);
sum1 += x;
}
for (int i = 1; i <= n - 1; ++i) {
int x;
scanf("%d", &x);
sum2 += x;
}
for (int i = 1; i <= n - 2; ++i) {
int x;
scanf("%d", &x);
sum3 += x;
}
printf("%lld\n%lld", sum1 - sum2, sum2 - sum3);
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 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; i++) {
if (i == n - 1) {
cout << a[n - 1] << endl;
break;
} else if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (i == n - 2) {
cout << b[n - 2] << endl;
break;
} else if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long i, a, b, c, r, n;
int main() {
cin >> n;
for (i = 1; i <= n; i++) {
cin >> r;
a += r;
}
for (i = 1; i <= n - 1; i++) {
cin >> r;
b += r;
}
for (i = 1; i <= n - 2; i++) {
cin >> r;
c += r;
}
cout << a - b << endl;
cout << b - c << endl;
}
|
#include <bits/stdc++.h>
int arra[10001];
int arrb[10001];
int arrc[10001];
int boo[10001];
bool binsearch(int a, int n, int* arr) {
int l = 0;
int r = n + 1;
int mid;
while (l < r - 1) {
mid = (l + r) / 2;
if (arr[mid] == a) {
if (boo[mid] == true)
return false;
else {
boo[mid] = true;
return true;
}
} else if (arr[mid] > a)
r = mid;
else
l = mid;
}
if (arr[l] == a && boo[l] != true) {
boo[l] = true;
return true;
} else
return false;
}
int main() {
using namespace std;
int n;
long long sum1 = 0, sum2 = 0, sum3 = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
int a;
cin >> a;
sum1 += a;
}
for (int i = 1; i < n; i++) {
int a;
cin >> a;
sum2 += a;
}
for (int i = 1; i < n - 1; i++) {
int a;
cin >> a;
sum3 += a;
}
cout << sum1 - sum2 << endl << sum2 - sum3;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
int ans1 = 0;
int ans2 = 0;
int ans3 = 0;
int sum1 = 0;
int sum2 = 0;
int ok;
cin >> k;
for (int i = 0; i < k; i++) {
cin >> ok;
ans1 += ok;
}
for (int i = 0; i < k - 1; i++) {
cin >> ok;
ans2 += ok;
}
sum1 = ans1 - ans2;
cout << sum1 << endl;
for (int i = 0; i < k - 2; i++) {
cin >> ok;
ans3 += ok;
}
sum2 = ans2 - ans3;
cout << sum2;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
vector<long long> a(n), b(n - 1), c(n - 2);
for (long long i = 0; i < n; i++) cin >> a[i];
for (long long i = 0; i < n - 1; i++) cin >> b[i];
for (long long i = 0; i < n - 2; i++) cin >> c[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
for (long long i = 0; i < n; i++) {
if (i == n - 1) {
cout << a[i] << endl;
break;
}
if (b[i] != a[i]) {
cout << a[i] << endl;
break;
}
}
for (long long i = 0; i < n - 1; i++) {
if (i == n - 2) {
cout << b[i] << endl;
break;
}
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
std::map<int, int> m, m2, m3;
int i, j, k;
int n;
cin >> n;
for (i = 0; i < n; i++) {
cin >> j;
m[j]++;
}
for (i = 0; i < n - 1; i++) {
cin >> j;
m2[j]++;
}
std::map<int, int>::iterator it;
it = m.begin();
for (; it != m.end(); it++) {
j = it->first;
if (m[j] != m2[j]) {
cout << j << endl;
}
}
for (i = 0; i < n - 2; i++) {
cin >> j;
m3[j]++;
}
it = m2.begin();
for (; it != m2.end(); it++) {
j = it->first;
if (m3[j] != m2[j]) {
cout << j << endl;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int first = 0, second = 0, third = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
first += x;
}
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
second += x;
}
for (int i = 0; i < n - 2; i++) {
int x;
cin >> x;
third += x;
}
cout << first - second << endl << second - third;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long sum1 = 0, sum2 = 0;
long temp;
for (int i = 0; i < n; i++) {
cin >> temp;
sum1 += temp;
}
for (int i = 0; i < n - 1; i++) {
cin >> temp;
sum2 += temp;
}
cout << sum1 - sum2 << "\n";
for (int i = 0; i < n - 2; i++) {
cin >> temp;
sum2 -= temp;
}
cout << sum2;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a = 0, b = 0, c = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a += x;
}
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
b += x;
}
for (int i = 0; i < n - 2; i++) {
int x;
cin >> x;
c += x;
}
cout << a - b << endl << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], b[100005], c[100005];
void Citire() {
long long x;
cin >> n;
int i;
x = 0;
for (i = 1; i <= n; i++) {
cin >> a[i];
x ^= a[i];
}
for (i = 1; i < n; i++) {
cin >> b[i];
x ^= b[i];
}
for (i = 1; i < n - 1; i++) cin >> c[i];
cout << x << "\n";
;
x = 0;
for (i = 1; i < n; i++) x ^= b[i];
for (i = 1; i < n - 1; i++) x ^= c[i];
cout << x << "\n";
}
int main() {
Citire();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a = 0, b = 0, c = 0, i, k, h;
cin >> k;
for (i = 0; i < k; i++) {
cin >> h;
a += h;
}
for (i = 0; i < k - 1; i++) {
cin >> h;
b += h;
}
cout << a - b << "\n";
for (i = 0; i < k - 2; i++) {
cin >> h;
c += h;
}
cout << b - c;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n{0}, f{0}, s{0}, o{0}, flag{2}, t{0}, flag1{0};
cin >> n;
o = n;
vector<long long int> vecf;
vector<long long int> vecs;
vector<long long int> veco;
while (o--) {
long long int c{0};
cin >> c;
veco.push_back(c);
}
sort(veco.begin(), veco.end());
t = veco[n - 1];
t = t + 1;
while (f < n) {
if (f < n - 1) {
long long int a{0};
cin >> a;
vecf.push_back(a);
} else
vecf.push_back(t);
f++;
}
while (s < n) {
if (s < n - 2) {
long long int b{0};
cin >> b;
vecs.push_back(b);
} else
vecs.push_back(t);
s++;
}
sort(vecf.begin(), vecf.end());
sort(vecs.begin(), vecs.end());
for (long long int i{0}; i < n; i++) {
for (long long int j{i}; j < n; j++) {
if (veco[i] == vecf[j])
break;
else {
cout << veco[i] << '\n';
flag = 1;
break;
}
}
if (flag == 1) break;
}
for (long long int i{0}; i < n; i++) {
for (long long int j{i}; j < n; j++) {
if (vecf[i] == vecs[j]) {
break;
} else {
cout << vecf[i] << '\n';
flag1 = 1;
break;
}
}
if (flag1 == 1) break;
}
cout << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
std::vector<int> v1(n);
std::vector<int> v2(n - 1);
std::vector<int> v3(n - 2);
for (int i = 0; i < n; i++) cin >> v1[i];
for (int i = 0; i < n - 1; i++) cin >> v2[i];
for (int i = 0; i < n - 2; i++) cin >> v3[i];
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
sort(v3.begin(), v3.end());
std::vector<int> v(2);
auto itr = v.begin();
set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), itr);
itr++;
set_difference(v2.begin(), v2.end(), v3.begin(), v3.end(), itr);
for (auto i : v) {
cout << i << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100100], a1[100100], a2[100100];
int main() {
while (scanf("%d", &n) != -1) {
int ans1 = -1, ans2 = -1;
for (int i = 0; i < n; i++) scanf("%d", a + i);
for (int i = 0; i < n - 1; i++) scanf("%d", a1 + i);
for (int i = 0; i < n - 2; i++) scanf("%d", a2 + i);
map<int, int> mp;
for (int i = 0; i < n - 1; i++) mp[a1[i]]++;
for (int i = 0; i < n; i++) {
if (mp[a[i]]-- <= 0) {
ans1 = a[i];
}
}
mp.clear();
for (int i = 0; i < n - 2; i++) mp[a2[i]]++;
for (int i = 0; i < n - 1; i++) {
if (mp[a1[i]]-- <= 0) {
ans2 = a1[i];
}
}
printf("%d\n%d\n", ans1, ans2);
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
struct debugger {
template <typename T>
debugger& operator,(const T& v) {
cerr << v << " ";
return *this;
}
} dbg;
template <class T>
T _abs(T n) {
return (n < 0 ? -n : n);
}
template <class T>
T _max(T a, T b) {
return (!(a < b) ? a : b);
}
template <class T>
T _min(T a, T b) {
return (a < b ? a : b);
}
template <class T>
T _swap(T& a, T& b) {
a = a ^ b;
b = a ^ b;
a = a ^ b;
}
template <class T>
T gcd(T a, T b) {
return (b == 0 ? a : gcd(b, a % b));
}
template <class T>
T lcm(T a, T b) {
return (a / gcd(a, b) * b);
}
int main() {
int n;
while (~scanf("%d", &n)) {
int a[n + 1], b[n + 1], c[n + 1];
map<int, int> a1;
map<int, int> b1;
map<int, int> c1;
a1.clear();
b1.clear();
c1.clear();
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
a1[a[i]]++;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &b[i]);
b1[b[i]]++;
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &c[i]);
c1[c[i]]++;
}
for (int i = 0; i < n; i++) {
int t = a[i];
if (b1[t] < a1[t]) {
printf("%d\n", t);
break;
}
}
for (int i = 0; i < n; i++) {
int t = a[i];
if (c1[t] < b1[t]) {
printf("%d\n", t);
break;
}
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
int e[300003];
int ee[300003];
unordered_map<int, int> m;
unordered_map<int, int> mm;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> e[i];
for (int i = 0; i < n; i++) m[e[i]]++;
for (int i = 0; i < n - 1; i++) cin >> ee[i];
for (int i = 0; i < n - 1; i++) mm[ee[i]]++;
for (int i = 0; i < n; i++)
if (m[e[i]] != mm[e[i]]) {
m[e[i]] = mm[e[i]];
cout << e[i] << endl;
}
m.clear();
for (int i = 0; i < n - 2; i++) cin >> e[i];
for (int i = 0; i < n - 2; i++) m[e[i]]++;
for (int i = 0; i < n - 1; i++)
if (m[ee[i]] != mm[ee[i]]) {
mm[ee[i]] = m[ee[i]];
cout << ee[i] << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i;
long long int data;
cin >> n;
long long int* all_errors;
long long int* first_comp;
long long int* second_comp;
all_errors = new long long int[n];
first_comp = new long long int[n - 1];
second_comp = new long long int[n - 2];
for (i = 0; i < n; i++) cin >> all_errors[i];
for (i = 0; i < n - 1; i++) cin >> first_comp[i];
for (i = 0; i < n - 2; i++) cin >> second_comp[i];
sort(all_errors, all_errors + n);
sort(first_comp, first_comp + (n - 1));
sort(second_comp, second_comp + (n - 2));
bool flag1 = false;
bool flag2 = false;
for (i = 0; i < n; i++) {
if (all_errors[i] != first_comp[i]) {
flag1 = true;
cout << all_errors[i] << endl;
break;
}
}
if (!flag1) {
cout << all_errors[n - 1] << endl;
}
for (i = 0; i < n - 1; i++) {
if (second_comp[i] != first_comp[i]) {
flag2 = true;
cout << first_comp[i] << endl;
break;
}
}
if (!flag2) cout << second_comp[n - 2] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[100000], b[1000000], c[100000];
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] << "\n";
break;
}
}
for (int i = 0; i < n; i++) {
if (c[i] != b[i]) {
cout << b[i];
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
long long int a[3] = {0, 0, 0};
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
a[0] += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
a[1] += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
a[2] += x;
}
cout << a[0] - a[1] << endl << a[1] - a[2];
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) {
cout << first[n - 1] << 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) {
cout << second[n - 2];
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, r;
long long sum1 = 0, sum2 = 0;
scanf("%d", &n);
for (a = 0; a < n; a++) {
scanf("%d", &r);
sum1 += r;
}
n--;
for (a = 0; a < n; a++) {
scanf("%d", &r);
sum2 += r;
}
cout << sum1 - sum2 << ' ';
n--;
for (a = 0, sum1 = 0; a < n; a++) {
scanf("%d", &r);
sum1 += r;
}
cout << sum2 - sum1;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n;
vector<int> e;
vector<int> e1;
vector<int> e2;
for (int i = 0; i < n; i++) {
cin >> x;
e.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
e1.push_back(x);
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
e2.push_back(x);
}
sort(e.begin(), e.end());
sort(e1.begin(), e1.end());
sort(e2.begin(), e2.end());
for (int i = 0; i < n; i++) {
if (e[i] != e1[i]) {
cout << e[i] << "\n";
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (e1[i] != e2[i]) {
cout << e1[i] << "\n";
break;
}
}
}
|
#include <bits/stdc++.h>
void merge(long long int *a, int L, int R) {
int M = (L + R) / 2;
int i = L, j = M + 1, k = 0;
int temp[R - L + 1];
while (i <= M && j <= R) {
if (a[i] <= a[j]) {
temp[k] = a[i];
++i;
} else {
temp[k] = a[j];
++j;
}
++k;
}
while (i <= M) {
temp[k] = a[i];
++i;
++k;
}
while (j <= R) {
temp[k] = a[j];
++j;
++k;
}
for (int i = 0; i < k; ++i) {
a[L + i] = temp[i];
}
}
void mergeSort(long long int *a, int L, int R) {
if (L == R) {
return;
} else {
int M = (L + R) / 2;
mergeSort(a, L, M);
mergeSort(a, M + 1, R);
merge(a, L, R);
}
}
int main() {
long long int n;
scanf("%lld", &n);
long long int input1[n], input2[n - 1], input3[n - 2];
for (int i = 0; i < n; i++) scanf("%lld", &input1[i]);
for (int i = 0; i < n - 1; i++) scanf("%lld", &input2[i]);
for (int i = 0; i < n - 2; i++) scanf("%lld", &input3[i]);
mergeSort(input1, 0, n - 1);
mergeSort(input2, 0, n - 2);
mergeSort(input3, 0, n - 3);
for (int i = 0; i < n; i++) {
if (input1[i] != input2[i]) {
printf("%lld\n", input1[i]);
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (input2[i] != input3[i]) {
printf("%lld\n", input2[i]);
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<int, int> map;
map.clear();
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
map[temp]++;
}
unordered_map<int, int> map2;
map2.clear();
for (int i = 0; i < n - 1; i++) {
int temp;
cin >> temp;
map2[temp]++;
map[temp]--;
}
for (auto i = map.begin(); i != map.end(); i++) {
if ((*i).second == 1) {
cout << (*i).first << endl;
break;
}
}
for (int i = 0; i < n - 2; i++) {
int temp;
cin >> temp;
map2[temp]--;
}
for (auto i = map2.begin(); i != map2.end(); i++) {
if ((*i).second == 1) {
cout << (*i).first << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
int compare(const void *a, const void *b) {
int ia = *(int *)a;
int ib = *(int *)b;
return ia - ib;
}
int main() {
static int aa[100000], bb[100000 - 1], cc[100000 - 2];
int n, i;
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &aa[i]);
for (i = 0; i < n - 1; i++) scanf("%d", &bb[i]);
for (i = 0; i < n - 2; i++) scanf("%d", &cc[i]);
qsort(aa, n, sizeof *aa, compare);
qsort(bb, n - 1, sizeof *bb, compare);
qsort(cc, n - 2, sizeof *cc, compare);
for (i = 0; i < n - 1; i++)
if (bb[i] != aa[i]) break;
printf("%d\n", aa[i]);
for (i = 0; i < n - 2; i++)
if (cc[i] != bb[i]) break;
printf("%d\n", bb[i]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, errorcode;
cin >> n;
map<int, int> set1;
map<int, int> set2;
map<int, int>::iterator it;
for (i = 0; i < n; i++) {
cin >> errorcode;
if (set1.count(errorcode)) {
set1[errorcode]++;
} else {
set1[errorcode] = 1;
}
}
for (i = 0; i < (n - 1); i++) {
cin >> errorcode;
set1[errorcode]--;
if (set2.count(errorcode)) {
set2[errorcode]++;
} else {
set2[errorcode] = 1;
}
}
for (it = set1.begin(); it != set1.end(); it++) {
if (it->second == 1) {
cout << it->first << endl;
}
}
for (i = 0; i < (n - 2); i++) {
cin >> errorcode;
set2[errorcode]--;
}
for (it = set2.begin(); it != set2.end(); it++) {
if (it->second == 1) {
cout << it->first << endl;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int pr(long long x) {
for (long long i = 2; i * i <= x; i++) {
if (x % i == 0) return 0;
}
return 1;
}
void amhu() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int arr[10000001];
int main() {
amhu();
int a, tp = 0, tp2 = 0, tp3 = 0, x, y, z;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> x;
tp += x;
}
int b = a - 1;
for (int i = 0; i < b; i++) {
cin >> y;
tp2 += y;
}
int c = b - 1;
for (int i = 0; i < c; i++) {
cin >> z;
tp3 += z;
}
cout << abs(tp - tp2) << "\n" << abs(tp2 - tp3) << 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 << endl << c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, q = 0, y = 0, d = 0, w;
cin >> n;
int a[n], b[n - 1], c[n - 2];
for (int i = 0; i < n; i++) {
cin >> a[i];
q += 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];
d += c[i];
}
cout << q - y << " " << y - d;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[100000], b[100000], c[100000];
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;
void affiche(int t[], int n) {
for (int i = 0; i < n; i++) cout << t[i] << " ";
cout << '\n';
}
void afficheV(vector<int> t) {
for (int i = 0; i < t.size(); i++) cout << t[i] << " ";
cout << '\n';
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
vector<int> v(n), v1(n - 1), v2(n - 2);
for (int i = 0; i < n; i++) cin >> v[i];
for (int i = 0; i < n - 1; i++) cin >> v1[i];
for (int i = 0; i < n - 2; i++) cin >> v2[i];
sort(v.begin(), v.end());
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
int c = 0, c2 = 0;
for (int i = 0; i < n - 1; i++)
if (v[i] != v1[i]) {
cout << v[i] << "\n";
c++;
break;
}
if (c == 0) cout << v[n - 1] << "\n";
for (int i = 0; i < n - 2; i++)
if (v2[i] != v1[i]) {
cout << v1[i];
c2++;
break;
}
if (c2 == 0) cout << v1[n - 2] << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100005];
long long b[100005];
long long c[100005];
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);
int i = 0;
int j = 0;
int f = 0;
while (f < 1) {
if (a[i] == b[j]) {
i++;
j++;
continue;
}
if (a[i] != b[j]) {
cout << a[i] << endl;
break;
f = 1;
}
}
i = 0;
j = 0;
f = 0;
while (f < 1) {
if (b[i] == c[j]) {
i++;
j++;
continue;
}
if (b[i] != c[j]) {
cout << b[i] << endl;
break;
f = 1;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int x1[N], x2[N], x3[N];
int n;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> x1[i];
for (int i = 0; i < n - 1; i++) cin >> x2[i];
for (int i = 0; i < n - 2; i++) cin >> x3[i];
sort(x1, x1 + n);
sort(x2, x2 + (n - 1));
sort(x3, x3 + (n - 2));
for (int i = 0; i < n; i++)
if (x1[i] != x2[i]) {
cout << x1[i] << endl;
break;
}
for (int i = 0; i < (n - 1); i++)
if (x2[i] != x3[i]) {
cout << x2[i];
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline istream& operator>>(istream& fin, pair<T1, T2>& pr) {
fin >> pr.first >> pr.second;
return fin;
}
template <class T0, class T1, class T2>
inline istream& operator>>(istream& fin, tuple<T0, T1, T2>& t) {
fin >> get<0>(t) >> get<1>(t) >> get<2>(t);
return fin;
}
template <class T>
inline istream& operator>>(istream& fin, vector<T>& a) {
if (!a.size()) {
size_t n;
fin >> n;
a.resize(n);
}
for (auto& u : a) fin >> u;
return fin;
}
const char* probA() {
vector<string> grid(8);
cin >> grid;
string piece = "QRBNPK.";
vector<int> score({9, 5, 3, 3, 1, 0, 0});
map<char, int> w;
for (size_t i = 0; i < 7; ++i) {
w[piece[i]] = score[i];
w[::tolower(piece[i])] = -score[i];
};
int val = 0;
for (const auto& r : grid)
for (const auto& x : r) val += w.at(x);
return val < 0 ? "Black" : 0 < val ? "White" : "Draw";
}
void probB() {
size_t n;
cin >> n;
vector<int> a(n);
cin >> a;
map<int, tuple<size_t, size_t, size_t> > m;
for (const auto x : a) ++get<0>(m[x]);
a.resize(n - 1);
cin >> a;
for (const auto x : a) ++get<1>(m[x]);
for (const auto& pr : m)
if (get<1>(pr.second) < get<0>(pr.second)) {
cout << pr.first << '\n';
break;
}
a.resize(n - 2);
cin >> a;
for (const auto x : a) ++get<2>(m[x]);
for (const auto& pr : m)
if (get<2>(pr.second) < get<1>(pr.second)) {
cout << pr.first << '\n';
break;
}
}
int main(const int argc, char* argv[]) {
probB();
return EXIT_SUCCESS;
}
|
#include <bits/stdc++.h>
int main() {
int n, i, x, s1 = 0, s2 = 0, s3 = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &x);
s1 = s1 + x;
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &x);
s2 = s2 + x;
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &x);
s3 = s3 + x;
}
printf("%d", s1 - s2);
printf("\n%d", s1 - (s3 + (s1 - s2)));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
long long sum0 = 0, sum1 = 0, sum2 = 0, x;
for (int i = 0; i < n; i++) {
cin >> x;
sum0 += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
sum1 += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
sum2 += x;
}
cout << sum0 - sum1 << '\n' << sum1 - sum2;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int test = 1;
while (test--) {
solve();
cout << '\n';
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
long long a, b, c, alla = 0, allb = 0, allc = 0;
int i, na, nb, nc, j;
scanf("%d", &na);
nb = na - 1;
nc = nb - 1;
for (i = 0; i < na; i++) {
scanf("%lld", &a);
alla += a;
}
for (i = 0; i < nb; i++) {
scanf("%lld", &b);
allb += b;
}
for (i = 0; i < nc; i++) {
scanf("%lld", &c);
allc += c;
}
printf("%lld\n%lld\n", alla - allb, allb - allc);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, s1 = 0, s2 = 0, s3 = 0;
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
s1 += a;
}
for (int i = 0; i < n - 1; ++i) {
int a;
cin >> a;
s2 += a;
}
for (int i = 0; i < n - 2; ++i) {
int a;
cin >> a;
s3 += a;
}
cout << s1 - s2 << endl << s2 - s3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int seq1[n], seq2[n], seq3[n];
for (int i = 0; i < n; i++) scanf("%d", &seq1[i]);
for (int i = 0; i < n - 1; i++) scanf("%d", &seq2[i]);
for (int i = 0; i < n - 2; i++) scanf("%d", &seq3[i]);
sort(seq1, seq1 + n);
sort(seq2, seq2 + n - 1);
sort(seq3, seq3 + n - 2);
int f = -1, s = -1, dif = 0;
for (int i = 0; i < n - 1; i++)
if (seq1[i] != seq2[i]) {
f = seq1[i];
break;
}
if (f == -1) f = seq1[n - 1];
for (int i = 0; i < n - 2; i++)
if (seq2[i] != seq3[i]) {
s = seq2[i];
break;
}
if (s == -1) s = seq2[n - 2];
printf("%d\n%d\n", f, s);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, arr[100006], arr1[100006], arr2[100006], i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> arr[i];
}
for (i = 0; i < n - 1; i++) {
cin >> arr1[i];
}
for (i = 0; i < n - 2; i++) {
cin >> arr2[i];
}
sort(arr, arr + n);
sort(arr1, arr1 + n - 1);
sort(arr2, arr2 + n - 2);
long long int j = 0;
for (i = 0; i < n - 1; i++) {
if (arr[i] != arr1[i]) {
cout << arr[i] << endl;
break;
}
}
if (i == n - 1) cout << arr[n - 1] << endl;
for (i = 0; i < n - 2; i++) {
if (arr1[i] != arr2[i]) {
cout << arr1[i] << endl;
break;
}
}
if (i == n - 2) cout << arr1[n - 2] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t, x, sum1 = 0, sum2 = 0, sum3 = 0, i;
cin >> t;
for (i = 0; i < t; i++) {
cin >> x;
sum1 = sum1 + x;
}
for (i = 0; i < t - 1; i++) {
cin >> x;
sum2 = sum2 + x;
}
for (i = 0; i < t - 2; i++) {
cin >> x;
sum3 = sum3 + x;
}
cout << sum1 - sum2 << endl << sum2 - sum3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, sum1 = 0, sum2 = 0, sum3 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
sum1 += x;
}
for (int i = 1; i < n; i++) {
int x;
cin >> x;
sum2 += x;
}
for (int i = 2; i < n; i++) {
int x;
cin >> x;
sum3 += x;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long s1 = 0, s2 = 0, a;
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a;
s1 += a;
}
s2 = s1;
for (int i = 0; i < n - 1; ++i) {
cin >> a;
s1 -= a;
}
for (int i = 0; i < n - 2; ++i) {
cin >> a;
s2 -= a;
}
s2 -= s1;
cout << s1 << endl << s2;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void erase(multiset<int> &S, int x) {
multiset<int>::iterator it = S.find(x);
if (it != S.end()) S.erase(it);
}
int main() {
int n;
while (scanf("%d", &n) == 1) {
multiset<int> S, T;
for (int i = 0; i < n; ++i) {
int x;
scanf("%d", &x);
S.insert(x);
}
for (int i = 0; i < n - 1; ++i) {
int x;
scanf("%d", &x);
T.insert(x);
erase(S, x);
}
int ans1 = *S.begin();
S = T;
for (int i = 0; i < n - 2; ++i) {
int x;
scanf("%d", &x);
erase(S, x);
}
int ans2 = *S.begin();
printf("%d\n%d\n", ans1, ans2);
}
}
|
#include <bits/stdc++.h>
int main() {
int n, i, sum1, sum2, sum3;
scanf("%d", &n);
sum1 = 0;
for (i = 0; i < n; i++) {
int a;
scanf("%d", &a);
sum1 ^= a;
}
sum2 = 0;
for (i = 0; i < n - 1; i++) {
int b;
scanf("%d", &b);
sum2 ^= b;
}
sum3 = 0;
for (i = 0; i < n - 2; i++) {
int c;
scanf("%d", &c);
sum3 ^= c;
}
printf("%d\n%d\n", sum1 ^ sum2, sum2 ^ sum3);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long a[n], b[n - 1], c[n - 2];
for (long long i = 0; i < n; i++) cin >> a[i];
for (long long i = 0; i < n - 1; i++) cin >> b[i];
for (long long i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
long long flag = 0;
for (long long i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
flag = 1;
break;
}
}
if (flag == 0) cout << a[n - 1] << endl;
flag = 0;
for (long long i = 0; i < n - 2; i++) {
if (b[i] != c[i]) {
cout << b[i] << endl;
flag = 1;
break;
}
}
if (flag == 0) cout << b[n - 2] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
void input(int* p, int range) {
for (int i = 0; i < range; i++) {
int x = 0;
cin >> x;
p[i] = x;
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n = 0;
cin >> n;
int* p1 = new int[n];
int* p2 = new int[n - 1];
int* p3 = new int[n - 2];
input(p1, n);
input(p2, n - 1);
input(p3, n - 2);
sort(p1, p1 + n);
sort(p2, p2 + n - 1);
sort(p3, p3 + n - 2);
int i;
for (i = 0; i < n - 1; i++) {
if (p1[i] != p2[i]) {
break;
}
}
cout << p1[i] << "\n";
for (i = 0; i < n - 2; i++) {
if (p2[i] != p3[i]) {
break;
}
}
cout << p2[i];
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int T;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, sum1 = 0, sum2 = 0, sum3 = 0;
cin >> n;
for (long long i = 1; i <= (n); i++) {
int k;
cin >> k;
sum1 += k;
}
for (long long i = 1; i <= (n - 1); i++) {
int k;
cin >> k;
sum2 += k;
}
for (long long i = 1; i <= (n - 2); i++) {
int k;
cin >> k;
sum3 += k;
}
cout << sum1 - sum2 << '\n' << sum2 - sum3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> a, b, c;
int n;
int arr[10001];
cin >> n;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
a.push_back(temp);
}
sort(a.begin(), a.end());
int first = 0, second = 0;
for (int i = 0; i < n - 1; i++) {
int temp;
cin >> temp;
b.push_back(temp);
}
sort(b.begin(), b.end());
for (int i = 0; i < n - 2; i++) {
int temp;
cin >> temp;
c.push_back(temp);
}
sort(c.begin(), c.end());
bool isfound = false;
for (int i = a.size() - 1; i >= 0; i--) {
if (i == 0 && !isfound)
first = a[i];
else if (!isfound) {
if (a[i] != b[i - 1]) {
first = a[i];
isfound = true;
}
}
}
isfound = false;
for (int i = b.size() - 1; i >= 0; i--) {
if (i == 0 && !isfound)
second = b[i];
else if (!isfound) {
if (b[i] != c[i - 1]) {
second = b[i];
isfound = true;
}
}
}
cout << first << endl << second << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long int> a(n);
vector<long int> b(n - 1);
vector<long int> 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.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
int misa, misb;
for (int i = 0; i < a.size(); i++) {
if (i == n - 1) {
misa = a[i];
} else if (a[i] != b[i]) {
misa = a[i];
break;
}
}
for (int i = 0; i < b.size(); i++) {
if (i == n - 2) {
misb = b[i];
} else if (b[i] != c[i]) {
misb = b[i];
break;
}
}
cout << misa << endl << misb << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a[300001];
long long b[300000];
long long c[29999];
bool used[600001];
int main() {
ios_base::sync_with_stdio(0);
int n, suma = 0, sumb = 0, sumc = 0;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
suma += a[i];
}
for (int i = 0; i < n - 1; ++i) {
cin >> b[i];
sumb += b[i];
}
for (int i = 0; i < n - 2; ++i) {
cin >> c[i];
sumc += c[i];
}
cout << suma - sumb << "\n" << sumb - sumc;
}
|
#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 1, 0, -1};
int dj[] = {1, 0, -1, 0};
int dik[] = {1, 1, 2, 2, -1, -1, -2, -2};
int djk[] = {2, -2, 1, -1, -2, 2, -1, 1};
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
int main() {
int n, a, b;
cin >> n, a = b = -1;
vector<int> x(n), y(n - 1), z(n - 2);
for (int i = 0; i < int(n); i++) scanf("%d", &x[i]);
for (int i = 0; i < int(n - 1); i++) scanf("%d", &y[i]);
for (int i = 0; i < int(n - 2); i++) scanf("%d", &z[i]);
sort(x.begin(), x.end()), sort(y.begin(), y.end()), sort(z.begin(), z.end());
for (int i = 0; i < int(n - 1); i++)
if (x[i] != y[i]) {
a = x[i];
break;
}
if (a == -1) a = x.back();
for (int i = 0; i < int(n - 2); i++)
if (y[i] != z[i]) {
b = y[i];
break;
}
if (b == -1) b = y.back();
printf("%d\n%d\n", a, b);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long int n;
cin >> n;
long int arr[n];
vector<long int> v, v1, v2;
for (long int i = 0; i < n; i++) {
long int a;
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
for (long int i = 0; i < n - 1; i++) {
long int a;
cin >> a;
v1.push_back(a);
}
sort(v1.begin(), v1.end());
for (long int i = 0; i < n - 2; i++) {
long int a;
cin >> a;
v2.push_back(a);
}
sort(v2.begin(), v2.end());
bool result = true;
long int value;
for (long int i = 0; i < n - 1; i++) {
if (v[i] != v1[i]) {
result = false;
value = v[i];
break;
}
}
if (result) value = v[n - 1];
cout << value << "\n";
result = true;
for (long int i = 0; i < n - 2; i++) {
if (v2[i] != v1[i]) {
result = false;
value = v1[i];
break;
}
}
if (result) value = v1[n - 2];
cout << value << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int N = (int)1e5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
multiset<int> st, st1, st2;
map<int, int> mp, mp1;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
mp[x]++;
}
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
mp[x]--;
if (mp[x] == 0) {
mp.erase(x);
}
mp1[x]++;
}
cout << mp.begin()->first << "\n";
for (int i = 0; i < n - 2; i++) {
int x;
cin >> x;
mp1[x]--;
if (mp1[x] == 0) {
mp1.erase(x);
}
}
cout << mp1.begin()->first << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, z, x, g, c;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> g;
z += g;
}
for (int i = 0; i < n - 1; i++) {
cin >> g;
x += g;
}
for (int i = 0; i < n - 2; i++) {
cin >> g;
c += g;
}
cout << z - x << endl << x - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y);
bool isPrime(long long n);
long long modInv(long long a, long long b);
long long gcdExtended(long long a, long long b, long long *x, long long *y);
long long mpower(long long a, long long b, long long p);
const long long inf = (long long)1e17;
const long long N = (long long)3e5 + 5;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long n;
cin >> n;
vector<long long> a(n), b(n - 1), c(n - 2);
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
for (long long i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (long long i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
long long fnd = -1;
for (long long i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
fnd = a[i];
break;
}
}
if (fnd == -1) {
cout << a[n - 1];
} else
cout << fnd;
cout << "\n";
fnd = -1;
for (long long i = 0; i < n - 2; i++) {
if (b[i] != c[i]) {
fnd = b[i];
break;
}
}
if (fnd == -1) {
cout << b[n - 2];
} else
cout << fnd << "\n";
return 0;
}
long long modInv(long long a, long long m) {
long long x, y;
long long g = gcdExtended(a, m, &x, &y);
long long res = (x % m + m) % m;
return res;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
if (a == 0) {
*x = 0, *y = 1;
return b;
}
long long x1, y1;
long long gcd = gcdExtended(b % a, a, &x1, &y1);
*x = y1 - (b / a) * x1;
*y = x1;
return gcd;
}
long long mpower(long long x, long long y, long long p) {
long long res = 1;
x = x % p;
while (y > 0) {
if (y & 1) res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
long long power(long long x, long long y) {
long long res = 1;
while (y > 0) {
if (y & 1) res = res * x;
y = y >> 1;
x = x * x;
}
return res;
}
bool isPrime(long long n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
long long p = sqrt(n);
for (long long i = 5; i <= p; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
return true;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> arr;
map<int, int> st;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
arr[a]++;
st[a]++;
}
for (int i = 0; i < n - 1; ++i) {
int a;
cin >> a;
arr[a]--;
}
for (map<int, int>::iterator it = st.begin(); it != st.end(); ++it) {
if (arr[it->first] > 0) {
cout << it->first << endl;
arr[it->first] = st[it->first] - 1;
it->second = st[it->first] - 1;
} else {
arr[it->first] = st[it->first];
}
}
for (int i = 0; i < n - 2; ++i) {
int a;
cin >> a;
arr[a]--;
}
for (map<int, int>::iterator it = st.begin(); it != st.end(); ++it) {
if (arr[it->first] > 0) {
cout << it->first << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long int binarySearch(vector<long int> arr, long int l, long int r,
long int x) {
if (r >= l) {
long int mid = l + (r - l) / 2;
if (arr[mid] == x) return mid;
if ((l == r) && (arr[mid] != x)) return -1;
if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
return binarySearch(arr, mid + 1, r, x);
}
return -1;
}
void merge(vector<long int> &arr, long int l, long int m, long int r) {
long int i, j, k;
long int n1 = m - l + 1;
long int n2 = r - m;
long int L[n1], R[n2];
for (i = 0; i < n1; i++) {
L[i] = arr[l + i];
}
for (j = 0; j < n2; j++) {
R[j] = arr[m + 1 + j];
}
i = 0;
j = 0;
k = l;
while (i < n1 && j < n2) {
if (L[i] <= R[j]) {
arr[k] = L[i];
i++;
} else {
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1) {
arr[k] = L[i];
i++;
k++;
}
while (j < n2) {
arr[k] = R[j];
j++;
k++;
}
}
void mergeSort(vector<long int> &arr, long int l, long int r) {
if (l < r) {
long int m = l + (r - l) / 2;
mergeSort(arr, l, m);
mergeSort(arr, m + 1, r);
merge(arr, l, m, r);
}
}
long int min(long int a, long int b) {
if (a < b) return a;
return b;
}
long int max(long int a, long int b) {
if (a > b) return a;
return b;
}
int main() {
int t;
cin >> t;
long long int sum = 0;
long long int sum1 = 0;
for (long int j = 0; j < t; j++) {
long int temp;
cin >> temp;
sum = sum + temp;
}
for (long int j = 0; j < t - 1; j++) {
long int temp;
cin >> temp;
sum1 = sum1 + temp;
}
cout << sum - sum1 << endl;
sum = 0;
for (long int j = 0; j < t - 2; j++) {
long int temp;
cin >> temp;
sum = sum + temp;
}
cout << sum1 - sum;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long p[n], q[n - 1], r[n - 2], a = 0, b = 0, c = 0;
for (long long i = 0; i < n; i++) {
cin >> p[i];
a += p[i];
}
for (long long i = 0; i < n - 1; i++) {
cin >> q[i];
b += q[i];
}
for (long long i = 0; i < n - 2; i++) {
cin >> r[i];
c += r[i];
}
cout << a - b << endl;
cout << b - c << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
void mergeArr(int l[], int nl, int r[], int nr, int a[]) {
int i = 0, j = 0, k = 0;
while (i < nl && j < nr) {
if (l[i] < r[j])
a[k] = l[i++];
else
a[k] = r[j++];
k++;
}
while (i < nl) a[k++] = l[i++];
while (j < nr) a[k++] = r[j++];
}
void mergeSort(int a[], int n) {
if (n == 1) return;
int n1 = n / 2, n2 = n - n1, l[n1], r[n2];
for (int i = 0; i < n1; i++) l[i] = a[i];
for (int i = 0; i < n2; i++) r[i] = a[i + n1];
mergeSort(l, n1);
mergeSort(r, n2);
mergeArr(l, n1, r, n2, a);
}
int main() {
int n, a[MAX], b[MAX], c[MAX];
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];
mergeSort(a, n);
mergeSort(b, n - 1);
mergeSort(c, n - 2);
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << '\n';
break;
}
}
for (int 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 main() {
long long n, x, sa = 0, sb = 0, sc = 0;
cin >> n;
for (int i = 0; i < n; i++) cin >> x, sa += x;
for (int i = 0; i < n - 1; i++) cin >> x, sb += x;
for (int i = 0; i < n - 2; i++) cin >> x, sc += x;
cout << sa - sb << " " << sb - sc << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int MACX = (int)1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
long long n, a[N], b[N], c[N];
multiset<long long> ms, ms2;
int main() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
ms.insert(a[i]);
}
for (int i = 1; i < n; i++) {
cin >> b[i];
ms.erase(ms.find(b[i]));
ms2.insert(b[i]);
}
for (int i = 1; i < n - 1; i++) {
cin >> c[i];
ms2.erase(ms2.find(c[i]));
}
cout << *ms.begin() << " " << *ms2.begin();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a = 0, b = 0, c = 0, t;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
a += t;
}
for (int i = 0; i < n - 1; i++) {
cin >> t;
b += t;
}
for (int i = 0; i < n - 2; i++) {
cin >> t;
c += t;
}
cout << a - b << endl << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
map<int, int> m, m1, m2;
map<int, int>::iterator it, it1, it2;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
m[x]++;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
m1[x]++;
}
for (it = m.begin(), it1 = m1.begin(); it != m.end(); it++, it1++)
if (it->first != it1->first || it->second != it1->second) {
cout << it->first << endl;
break;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
m2[x]++;
}
for (it1 = m1.begin(), it2 = m2.begin(); it1 != m.end(); it1++, it2++)
if (it1->first != it2->first || it1->second != it2->second) {
cout << it1->first;
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<int> c;
vector<int> b;
int n;
int aux;
int r1;
int r2;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &aux);
a.push_back(aux);
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &aux);
b.push_back(aux);
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &aux);
c.push_back(aux);
}
c.push_back(1000000001);
c.push_back(1000000001);
b.push_back(1000000001);
sort(a.begin(), a.end());
sort(c.begin(), c.end());
sort(b.begin(), b.end());
int flag = 0;
int i = 0;
while (i < a.size()) {
if (a.at(i) != c.at(i)) {
if (b.at(i) != a.at(i)) {
r1 = a.at(i);
a.erase(a.begin() + i);
i--;
} else {
r2 = a.at(i);
a.erase(a.begin() + i);
b.erase(b.begin() + i);
i--;
}
}
i++;
}
printf("%d\n%d\n", r1, r2);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
multiset<int> s1;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
s1.insert(x);
}
multiset<int> ss = s1;
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
s1.erase(s1.find(x));
}
cout << *s1.begin() << endl;
swap(s1, ss);
for (int i = 0; i < n - 2; i++) {
int x;
cin >> x;
s1.erase(s1.find(x));
}
s1.erase(s1.find(*ss.begin()));
cout << *s1.begin();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b[n], c[n], active = 0;
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));
b[n - 1] = -2;
c[n - 2] = -2;
c[n - 1] = -2;
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << "\n";
active = i;
break;
}
}
for (int i = 0; i < n; i++) {
if (b[i] != c[i]) {
cout << b[i] << "\n";
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long len(vector<long long> v) { return (v.size()); }
long long len(string s) { return (s.length()); }
long long ask(...) {
long long x;
cin >> x;
return x;
}
void solve() {}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t = 1;
long long cccc = t;
while (t--) {
long long n;
cin >> n;
map<long long, long long> f1;
map<long long, long long> f2;
map<long long, long long> f3;
map<long long, long long> f4;
for (long long i = 0; i <= n - 1; i++) {
long long x;
cin >> x;
f1[x]++;
}
f2 = f1;
for (long long i = 0; i <= n - 2; i++) {
long long x;
cin >> x;
f2[x]--;
f3[x]++;
}
for (auto i : f2) {
if (i.second != 0) {
cout << i.first << "\n";
break;
}
}
f4 = f3;
for (long long i = 0; i <= n - 3; i++) {
long long x;
cin >> x;
f4[x]--;
}
for (auto i : f4) {
if (i.second != 0) {
cout << i.first << "\n";
break;
}
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long s1 = 0, s2 = 0, s3 = 0;
for (int i = 0; i < n; i++) {
int num;
cin >> num;
s1 += num;
}
for (int i = 0; i < n - 1; i++) {
int num;
cin >> num;
s2 += num;
}
for (int i = 0; i < n - 2; i++) {
int num;
cin >> num;
s3 += num;
}
cout << s1 - s2 << endl << s2 - s3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int findDiffer(vector<long long> a, vector<long long> b) {
long long v{0};
for (int i = 0; i < a.size(); ++i) {
if (a[i] != b[i]) {
v = a[i];
break;
}
}
return v;
}
long long n;
void in() { cin >> n; }
void out() {
vector<long long> 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.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
long long a1, a2;
a1 = findDiffer(a, b);
a2 = findDiffer(b, c);
cout << a1 << "\n" << a2;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long t = 1;
while (t--) {
in();
out();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b[n - 1], c[n - 2], p, q;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
sort(b, b + (n - 1));
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 (a[i] != b[i]) {
p = a[i];
break;
}
if (i == n - 2) {
p = a[n - 1];
}
}
for (int i = 0; i < n - 2; i++) {
if (c[i] != b[i]) {
q = b[i];
break;
}
if (i == n - 3) {
q = b[n - 2];
}
}
cout << p << '\n' << q;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a[100001], b[100001], c[100001];
int main() {
int n, i, j = 0, suma = 0, sumb = 0, sumc = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
suma += a[i];
}
for (i = 0; i < n - 1; i++) {
cin >> b[i];
sumb += b[i];
}
for (i = 0; i < n - 2; i++) {
cin >> c[i];
sumc += c[i];
}
for (i = 0; i < n; i++) {
if (sumb + a[i] == suma) {
cout << a[i] << endl;
break;
}
}
for (i = 0; i < n - 1; i++) {
if (sumc + b[i] == sumb) {
cout << b[i] << endl;
break;
}
}
}
|
#include <bits/stdc++.h>
int main() {
unsigned long long int x[100000], y[100000], z[100000], counter1 = 0,
counter2 = 0;
long int n, i;
scanf("%ld", &n);
for (i = 0; i < 3 * n - 3; i++) {
if (i < n)
scanf("%llu", &x[i]);
else if (i < 2 * n - 1)
scanf("%llu", &y[i - n]);
else
scanf("%llu", &z[i - 2 * n + 1]);
}
for (i = 0; i < n; i++) {
if (i != n - 1) {
counter1 += x[i] - y[i];
} else {
counter1 += x[i];
}
if (i != n - 2 && i != n - 1) {
counter2 += y[i] - z[i];
} else if (i == n - 2) {
counter2 += y[i];
}
}
printf("%llu\n%llu", counter1, counter2);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, sum[3] = {0}, j, yo;
cin >> n;
for (i = 0; i < 3; ++i)
for (j = 0; j < n - i; ++j) {
cin >> yo;
sum[i] += yo;
}
cout << sum[0] - sum[1] << endl;
cout << sum[1] - sum[2];
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
long long a = 0, b = 0, c = 0, m;
cin >> n;
for (i = 0; i < n; i++) {
cin >> m;
a += m;
}
for (i = 0; i < n - 1; i++) {
cin >> m;
b += m;
}
for (i = 0; i < n - 2; i++) {
cin >> m;
c += m;
}
cout << a - b << endl << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* comma = strchr(names + 1, ',');
cout.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
const long long int N = 100005;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
{
long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
cin >> n;
long long int a[n];
long long int mx = -1;
m = -1;
for (i = 0; i < n; i++) {
cin >> a[i];
if (m == -1)
m = a[i];
else
m = (m ^ a[i]);
}
k = -1;
for (i = 0; i < n - 1; i++) {
cin >> a[i];
if (k == -1)
k = a[i];
else
k = (k ^ a[i]);
}
j = -1;
for (i = 0; i < n - 2; i++) {
cin >> a[i];
if (j == -1)
j = a[i];
else
j = (j ^ a[i]);
}
cout << (k ^ m) << endl;
cout << (k ^ j) << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, x, arr[100005], ar[100005], a[100005];
vector<int> v;
cin >> n;
for (i = 0; i < n; i++) {
cin >> arr[i];
}
for (i = 0; i < n - 1; i++) {
cin >> ar[i];
}
sort(arr, arr + n);
sort(ar, ar + n - 1);
for (i = 0; i < n; i++) {
if (arr[i] != ar[i]) {
v.push_back(arr[i]);
break;
}
}
for (i = 0; i < n - 2; i++) {
cin >> a[i];
}
sort(a, a + n - 2);
for (i = 0; i < n - 1; i++) {
if (ar[i] != a[i]) {
v.push_back(ar[i]);
break;
}
}
for (i = 0; i < v.size(); i++) {
cout << v[i] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0, a = 0, b = 0;
cin >> n;
int* error1 = new int[n];
int* error2 = new int[n - 1];
int* error3 = new int[n - 2];
for (int i = 0; i < n; i++) {
cin >> error1[i];
}
b = n - 1;
for (int i = 0; i < b; i++) {
cin >> error2[i];
}
b = n - 2;
for (int i = 0; i < b; i++) {
cin >> error3[i];
}
sort(error1, error1 + n);
sort(error2, error2 + n - 1);
sort(error3, error3 + n - 2);
for (int i = 0; i < n; i++) {
if (error1[i] != error2[i]) {
cout << error1[i] << '\n';
break;
}
}
for (int i = 0; i < n; i++) {
if (error2[i] != error3[i]) {
cout << error2[i] << '\n';
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, k;
scanf("%d", &n);
int a[n], b[n - 1], c[n - 2], x[2];
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]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n; i++) {
if (b[i] != c[i]) {
cout << b[i];
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
int a[N], b[N], c[N];
map<int, int> cnt1, cnt2;
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", a + i);
cnt1[a[i]]++;
cnt2[a[i]]++;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", b + i);
cnt1[b[i]]--;
}
for (auto ite : cnt1)
if (ite.second > 0) {
cout << ite.first << '\n';
cnt2[ite.first]--;
break;
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", c + i);
cnt2[c[i]]--;
}
for (auto ite : cnt2)
if (ite.second > 0) {
cout << ite.first << '\n';
return 0;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, x, a, b, c;
int main() {
cin >> n;
for (long long i = 1; i <= n; i++) {
cin >> x;
a += x;
}
for (long long i = 1; i <= n - 1; i++) {
cin >> x;
b += x;
}
for (long long i = 1; i <= n - 2; i++) {
cin >> x;
c += x;
}
cout << a - b << " " << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ar[n], ar2[n - 1], ar3[n - 2];
for (int i = 0; i < n; i++) {
cin >> ar[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> ar2[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> ar3[i];
}
sort(ar, ar + n);
sort(ar2, ar2 + n - 1);
sort(ar3, ar3 + n - 2);
ar2[n - 1] = 0;
ar3[n - 2] = 0;
for (int i = 0; i < n; i++) {
if (ar[i] != ar2[i]) {
cout << ar[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (ar2[i] != ar3[i]) {
cout << ar2[i] << endl;
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, temp;
cin >> n;
int sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 0; i < n; i++) {
cin >> temp;
sum1 += temp;
}
for (int i = 0; i < (n - 1); i++) {
cin >> temp;
sum2 += temp;
}
for (int i = 0; i < (n - 2); i++) {
cin >> temp;
sum3 += temp;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
}
int main() { solve(); }
|
#include <bits/stdc++.h>
int a[100001], b[100001], c[100001];
int main() {
int n, i, j, k;
int sum1, sum2;
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
memset(c, 0, sizeof(c));
scanf("%d", &n);
for (i = 1; i <= n; i++) scanf("%d", &a[i]);
for (i = 1; i < n; i++) scanf("%d", &b[i]);
for (i = 1; i <= n - 2; i++) scanf("%d", &c[i]);
sum1 = sum2 = 0;
for (i = 1; i <= n; i++) {
sum1 += a[i];
sum1 -= b[i];
}
for (i = 1; i <= n - 1; i++) {
sum2 += b[i];
sum2 -= c[i];
}
printf("%d\n%d\n", sum1, sum2);
}
|
#include <bits/stdc++.h>
using namespace std;
int binarySearch(int arr[], int p, int r, int num) {
if (p <= r) {
int mid = (p + r) / 2;
if (arr[mid] == num) return mid;
if (arr[mid] > num) return binarySearch(arr, p, mid - 1, num);
if (arr[mid] < num) return binarySearch(arr, mid + 1, r, num);
}
return -1;
}
int main() {
int n;
cin >> n;
vector<int> arr(n);
vector<int> arr2(n - 1);
vector<int> arr3(n - 2);
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];
}
int ind = -1;
sort(arr.begin(), arr.end());
sort(arr2.begin(), arr2.end());
sort(arr3.begin(), arr3.end());
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr2[i]) {
ind = i;
break;
}
}
if (ind > -1)
cout << arr[ind] << "\n";
else
cout << arr[n - 1] << "\n";
ind = -1;
for (int i = 0; i < n - 2; i++) {
if (arr2[i] != arr3[i]) {
ind = i;
break;
}
}
if (ind > -1)
cout << arr2[ind] << "\n";
else
cout << arr2[n - 2] << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, sum, sum1, sum2;
sum = sum1 = sum2 = 0;
cin >> n;
for (long long i = 0; i < n; i++) {
scanf("%lld", &a);
sum += a;
}
for (long long i = 0; i < n - 1; i++) {
scanf("%lld", &a);
sum1 += a;
}
for (long long i = 0; i < n - 2; i++) {
scanf("%lld", &a);
sum2 += a;
}
cout << sum - sum1 << endl;
cout << sum1 - sum2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long b[100005], c[100005], d[100005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long a;
cin >> a;
for (int i = 0; i <= a - 1; i++) {
cin >> b[i];
}
sort(b, b + a);
for (int i = 0; i <= a - 2; i++) {
cin >> c[i];
}
sort(c, c - 1 + a);
for (int i = 0; i <= a - 1; i++) {
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
for (int i = 0; i <= a - 3; i++) {
cin >> d[i];
}
sort(d, d + a - 2);
for (int i = 0; i <= a - 2; i++) {
if (c[i] != d[i]) {
cout << c[i] << endl;
break;
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.