# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
259054 | ChrisT | Boat (APIO16_boat) | C++17 | 1133 ms | 11512 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;
using ll = long long;
using pii = pair<int,int>;
const int MN = 505, LOG = 18, MOD = 1e9 + 7;
int dp[MN][MN<<1],pre[MN<<1][MN][2],a[MN],b[MN];
int ch[MN][MN], ch2[MN<<1][MN][2], iv[MN<<1];
int inv (int base) {
int res = 1, exp = MOD - 2;
while (exp) {
if (exp&1) res = (ll)res * base % MOD;
base = (ll)base * base % MOD;
exp>>=1;
}
return res;
}
int choose (int n, int k) {
assert(n >= 0 && k >= 0);
int res = 1;
for (int i = n; i > n-k; i--) res = (ll)res * i % MOD;
for (int i = 2; i <= k; i++) res = (ll)res * iv[i] % MOD;
return res;
}
int calc (int j, int x, bool ree) {
int ret = ch2[j][x-ree][ree];
for (int zeros = 1; zeros <= x-2; zeros++) ret = (ret + (ll)ch2[j][x-zeros-ree][ree] * ch[x-2][zeros]) % MOD;
return ret;
}
int main () {
int n;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |