# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
854391 | Tenis0206 | Fishing Game (RMI19_fishing) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}