답안 #347446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
347446 2021-01-13T05:24:34 Z ijxjdjd Fishing Game (RMI19_fishing) C++14
0 / 100
339 ms 333676 KB
#include <bits/stdc++.h>
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;

using ll = long long;
ll MOD = (int)(1e9) + 7;
const int MAXN = 305;
int dp[MAXN][MAXN][MAXN][3];
ll fill(int a, int b, int c, int d) {
    if (a == 0 && b == 0 && c == 0) {
        return 1;
    }
    if (a < 0 || b < 0 || c < 0 || d >= 3) {
        return 0;
    }
    if (dp[a][b][c][d] != -1) {
        return dp[a][b][c][d];
    }
    else {
        dp[a][b][c][d] = (int)((a*fill(b, c, a-1, 0) + c*fill(b+1, c-1, a, d+1))%MOD);
        return dp[a][b][c][d];
    }
}
int main() {
	cin.tie(0);
	cin.sync_with_stdio(0);
	FR(i, MAXN) {
        FR(j, MAXN) {
            FR(k, MAXN) {
                FR(z, 3) {
                    dp[i][j][k][z] = -1;
                }
            }
        }
    }
	int T;
	int N;
	cin >> N;
	cin >> T;
	while (T-->0) {
        vector<int> vecs[3];
        FR(j, 3) {
            FR(i, 2*N) {
                int a;
                cin >> a;
                auto it = find(all(vecs[j]), a);
              if (it == vecs[j].end()) {
                vecs[j].push_back(a);
              }
            }
        }
        int c[3];
        memset(c, 0, sizeof(c));
        FR(j, 3) {
            FR(i, vecs[j].size()) {
                if (find(all(vecs[(j+1)%3]), vecs[j][i]) != vecs[(j+1)%3].end()) {
                    c[j]++;
                }
            }
        }
        cout << fill(c[0], c[1], c[2], 0) << '\n';
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 189 ms 333548 KB Output isn't correct
2 Incorrect 186 ms 333548 KB Output isn't correct
3 Incorrect 187 ms 333548 KB Output isn't correct
4 Incorrect 192 ms 333676 KB Output isn't correct
5 Incorrect 205 ms 333676 KB Output isn't correct
6 Incorrect 219 ms 333548 KB Output isn't correct
7 Incorrect 232 ms 333548 KB Output isn't correct
8 Incorrect 262 ms 333568 KB Output isn't correct
9 Incorrect 300 ms 333548 KB Output isn't correct
10 Incorrect 339 ms 333548 KB Output isn't correct