Skip to content

Commit 9a8fef1

Browse files
committed
atcoder/abc050C
1 parent b2f81d9 commit 9a8fef1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

atcoder/abc050/C/main.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
ll const MOD = 1e9 + 7;
8+
int N;
9+
vector<int> A;
10+
11+
ll solve() {
12+
sort(A.begin(), A.end());
13+
if (N % 2 == 0 && A[0] == 0) return 0;
14+
if (N % 2 == 1 && A[0] != 0) return 0;
15+
for (int i = N % 2; i < N; i += 2) {
16+
if (i > 0 && A[i] == A[i-1]) return 0;
17+
if (A[i] != A[i+1]) return 0;
18+
}
19+
int M = N / 2;
20+
ll ans = 1;
21+
for (int i = 0; i < M; ++i) {
22+
ans = (ans * 2) % MOD;
23+
}
24+
return ans;
25+
}
26+
27+
int main() {
28+
ios_base::sync_with_stdio(false);
29+
cin.tie(0); cout.tie(0);
30+
31+
cin >> N;
32+
A.assign(N, 0);
33+
for (auto &a : A) cin >> a;
34+
cout << solve() << endl;
35+
36+
return 0;
37+
}

0 commit comments

Comments
 (0)