#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t, k1, k2, k3;
cin >> t;
while(t--)
{
cin >> k1 >> k2 >> k3;
ll a[k1+1], c[k3+1], n1, n2, i;
map<ll, ll>mp;
ll j = 0, f = 1;
for(i=1; i<=k1; i++)
a[i] = 1;
for(i=1; i<=k2; i++)
{
cin >> n1 >> n2;
mp[n1] = n2;
}
for(i=1; i<=k3; i++)
{
cin >> c[i];
if(f)
{
j++;
a[j] += c[i];
if(mp[a[j]] != 0)
a[j] = mp[a[j]];
if(a[j] >= 100)
{
a[j] = 100;
f = 0;
}
if(j == k1)
j = 0;
}
}
for(i=1; i<=k1; i++)
cout << "Position of player " << i << " is " << a[i] << "." << "\n";
}
return 0;
}
#define ll long long int
using namespace std;
int main()
{
ll t, k1, k2, k3;
cin >> t;
while(t--)
{
cin >> k1 >> k2 >> k3;
ll a[k1+1], c[k3+1], n1, n2, i;
map<ll, ll>mp;
ll j = 0, f = 1;
for(i=1; i<=k1; i++)
a[i] = 1;
for(i=1; i<=k2; i++)
{
cin >> n1 >> n2;
mp[n1] = n2;
}
for(i=1; i<=k3; i++)
{
cin >> c[i];
if(f)
{
j++;
a[j] += c[i];
if(mp[a[j]] != 0)
a[j] = mp[a[j]];
if(a[j] >= 100)
{
a[j] = 100;
f = 0;
}
if(j == k1)
j = 0;
}
}
for(i=1; i<=k1; i++)
cout << "Position of player " << i << " is " << a[i] << "." << "\n";
}
return 0;
}
Comments
Post a Comment