Submission #2208730
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int N = (int) 1e5; const int mod = (int) 1e9 + 7; int fast_pow(int x, int n) { if (n == 0) { return 1; } if (n % 2 == 0) { int y = fast_pow(x, n / 2); return y * 1LL * y % mod; } return fast_pow(x, n - 1) * 1LL * x % mod; } int f[N + 1]; int g[N + 1]; void init() { f[0] = 1; for (int i = 1; i <= N; i++) { f[i] = f[i - 1] * 1LL * i % mod; // cerr << f[i] << "\n"; } g[0] = 1; for (int i = 1; i <= N; i++) { g[i] = g[i - 1] * 1LL * fast_pow(i, mod - 2) % mod; } } int C(int n, int k) { return f[n] * 1LL * g[k] % mod * g[n - k] % mod; } int a[N]; int main() { int n; cin >> n; int p = -1; int d = -1; for (int i = 0; i < n + 1; i++) { cin >> a[i]; if (a[i] == 1) { if (p == -1) { p = i; } else { d = i - p + 1; } } } // C(N + 1, K) // C(N + 1 - D, K - 1) init(); for (int k = 1; k <= n + 1; k++) { // cerr << C(n + 1, k) << "\n"; cout << C(n + 1, k) - C(n + 1 - d, k - 1) << "\n"; } }
Submission Info
Submission Time | |
---|---|
Task | D - 11 |
User | IAmNomad |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1168 Byte |
Status | WA |
Exec Time | 72 ms |
Memory | 2176 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 600 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | 1.txt, mx.txt, rnd_0.txt, rnd_1.txt, rnd_2.txt, rnd_3.txt, rnd_4.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | WA | 72 ms | 1664 KB |
mx.txt | WA | 72 ms | 1664 KB |
rnd_0.txt | WA | 68 ms | 2176 KB |
rnd_1.txt | WA | 61 ms | 2048 KB |
rnd_2.txt | WA | 37 ms | 1280 KB |
rnd_3.txt | WA | 36 ms | 1280 KB |
rnd_4.txt | WA | 42 ms | 1408 KB |
sample1.txt | AC | 29 ms | 1024 KB |
sample2.txt | AC | 29 ms | 1024 KB |
sample3.txt | WA | 29 ms | 1024 KB |