# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854391 | Tenis0206 | Fishing Game (RMI19_fishing) | C++11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int nmax = 100;
const int Mod = 1e9 + 7;
void solve_test()
{
for(int i=1;i<=2*n;i++)
{
int x;
cin>>x;
if(!p[x].first)
{
p[x].first = 1;
}
else
{
p[x].second = 1;
}
}
for(int i=1;i<=2*n;i++)
{
int x;
cin>>x;
if(!p[x].first)
{
p[x].first = 2;
}
else
{
p[x].second = 2;
}
}
for(int i=1;i<=2*n;i++)
{
int x;
cin>>x;
if(!p[x].first)
{
p[x].first = 3;
}
else
{
p[x].second = 3;
}
}
int nr_tot = 3 * n;
for(int i=1;i<=3*n;i++)
{
if(p[i].first==p[i].second)
{
--nr_tot;
continue;
}
if(p[i].first==1 && p[i].second==2)
{
++nrab;
}
else if(p[i].first==1 && p[i].second==3)
{
++nrac;
}
}
dp[nr_tot][nrab][nrac] = 1;
for(int nr=nr_tot;nr>=1;nr--)
{
for(int ab=0;ab<=nr;ab++)
{
for(int ac=0;ab+ac<=nr;ac++)
{
int bc = nr - ab - ac;
for(int a=1;a<=3;a++)
{
for(int b=1;b<=3;b++)
{
for(int c=1;c<=3;c++)
{
update(nr,ab,ac,a,b,c);
}
}
}
}
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
#ifdef home
freopen("nr.in","r",stdin);
freopen("nr.out","w",stdout);
#endif // home
cin>>n>>t;
for(int i=1;i<=t;i++)
{
solve_test();
}
return 0;
}