File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments