#include<bits/stdc++.h>
#define p pair<int, int>
using namespace std;
vector<p>v;
int main()
{
int n, j = 1, i;
while(cin >> n && n != 0)
{
vector<int>a(n+1), b(10), c(n+1), d(10);
for(i=1;i<=n;i++)
{
cin >> a[i];
b[a[i]]++;
}
while(1)
{
int f = 0, cnt1 = 0, cnt2 = 0;
d = b;
for(i=1;i<=n;i++)
{
cin >> c[i];
if(c[i] != 0)
f = 1;
if(c[i] == a[i])
{
d[c[i]]--;
c[i] = 0;
cnt1++;
}
}
if(f)
{
for(i=1;i<=n;i++)
{
if(d[c[i]] > 0)
{
d[c[i]]--;
cnt2++;
}
}
v.push_back(p(cnt1, cnt2));
}
else
break;
}
cout << "Game " << j++ << ":\n";
for(i=0;i<v.size();i++)
cout << " " << "(" << v[i].first << "," << v[i].second << ")\n";
v.clear();
}
return 0;
}
#define p pair<int, int>
using namespace std;
vector<p>v;
int main()
{
int n, j = 1, i;
while(cin >> n && n != 0)
{
vector<int>a(n+1), b(10), c(n+1), d(10);
for(i=1;i<=n;i++)
{
cin >> a[i];
b[a[i]]++;
}
while(1)
{
int f = 0, cnt1 = 0, cnt2 = 0;
d = b;
for(i=1;i<=n;i++)
{
cin >> c[i];
if(c[i] != 0)
f = 1;
if(c[i] == a[i])
{
d[c[i]]--;
c[i] = 0;
cnt1++;
}
}
if(f)
{
for(i=1;i<=n;i++)
{
if(d[c[i]] > 0)
{
d[c[i]]--;
cnt2++;
}
}
v.push_back(p(cnt1, cnt2));
}
else
break;
}
cout << "Game " << j++ << ":\n";
for(i=0;i<v.size();i++)
cout << " " << "(" << v[i].first << "," << v[i].second << ")\n";
v.clear();
}
return 0;
}
Comments
Post a Comment