# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207159 | mayhoubsaleh | Fishing Game (RMI19_fishing) | C++14 | 589 ms | 129016 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>
#include <string>
#define ll long long
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int mod=1e9+7;
int n;
int dp[3][222][222][222];
map<int,int>m[3];
int cnt[3];
int sz[3];
int f(int pl,int cnt[],int sz[]){
int &ans=dp[pl][cnt[0]][cnt[1]][cnt[2]];
if(ans+1)return ans;
ans=0;
if(!sz[pl])return ans=1;
if(cnt[pl]){
cnt[pl]--;
sz[pl]--;
sz[(pl+1)%3]--;
ans=(ans+(cnt[pl]+1)*f((pl+1)%3,cnt,sz)%mod)%mod;
sz[(pl+1)%3]++;
sz[pl]++;
cnt[pl]++;
}
if(sz[pl]-cnt[pl]){
int x=sz[pl]-cnt[pl];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |