Pagini recente » Cod sursa (job #934154) | Cod sursa (job #1952201) | Cod sursa (job #1001906) | Cod sursa (job #1259523) | Cod sursa (job #1212922)
#include <iostream>
#include <fstream>
using namespace std;
// <parsing>
FILE* f = fopen("avarcolaci.in", "r");
const int maxb = 8192;
char buf[maxb];
int ptr = maxb;
inline int getInt()
{
while (buf[ptr] < '0' || buf[ptr] > '9') {
if (++ptr >= maxb) {
fread(buf, maxb, 1, f);
ptr = 0;
}
}
int nr = 0;
while ('0' <= buf[ptr] && buf[ptr] <= '9') {
nr = nr * 10 + buf[ptr] - '0';
if (++ptr >= maxb) {
fread(buf, maxb, 1, f);
ptr = 0;
}
}
return nr;
}
void reset()
{
fclose(f);
f = fopen("avarcolaci.in", "r");
ptr = maxb;
}
// </parsing>
FILE* g = fopen("avarcolaci.out", "w");
void read_crap(int id)
{
int trash, n;
trash = getInt();
for (int i = 1; i < id; i++) {
n = getInt();
for (int j = 1; j <= n * 2; j++) {
trash = getInt();
}
}
}
void do_test(int id)
{
int n, el, s = 0;
n = getInt();
for (int i = 1, x; i <= n * 2; i++) {
x = getInt();
if (s == 0) {
s = 1;
el = x;
} else if (x == el) {
s++;
} else {
s--;
}
}
reset();
read_crap(id);
s = 0;
n = getInt();
for (int i = 1, x; i <= n * 2; i++) {
x = getInt();
if (x == el) {
s++;
}
}
if (s <= n) {
fprintf(g, "Mozart\n");
} else {
fprintf(g, "%d\n", el);
}
}
int main()
{
int t;
t = getInt();
for (int i = 1; i <= t; i++) {
do_test(i);
}
}