Submission #1031642
Source Code Expand
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i)) #define rep(i,n) FOR(i,0,n) #define pb push_back #define eb emplace_back #define mp make_pair #define fst first #define snd second #define all(v) begin(v), end(v) #define debug(x) cerr<< #x <<": "<<x<<endl #define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef vector<vector<ll> > vvll; template<class T> using vv=vector<vector< T > >; int mod = 1e9 + 7; ll pow_mod(int x) { if (x == 0) { return 1; } ll y = pow_mod(x / 2); y = (y * y) % mod; if (x % 2 == 1) { y = y * 2 % mod; } return y; } int main() { int n; scanf("%d", &n); vll a(n); rep (i, n) { scanf("%lld", &a[i]); } sort(all(a)); if (n % 2 == 0) { rep (i, n) { int expect = i / 2 * 2 + 1; if (a[i] != expect) { printf("0\n"); return 0; } } ll ans = pow_mod(n / 2); printf("%lld\n", ans); return 0; } else { if (a[0] != 0) { printf("0\n"); return 0; } FOR (i, 1, n) { int expect = (i+1) / 2 * 2; if (a[i] != expect) { printf("0\n"); return 0; } } ll ans = pow_mod(n / 2); printf("%lld\n", ans); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Lining Up |
User | tspcx |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 1822 Byte |
Status | AC |
Exec Time | 20 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | subtask_1_invalid_01.txt, subtask_1_invalid_02.txt, subtask_1_max_01.txt, subtask_1_max_02.txt, subtask_1_max_valid_01.txt, subtask_1_max_valid_02.txt, subtask_1_min_valid_01.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt, subtask_1_valid_01.txt, subtask_1_valid_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 9 ms | 888 KB |
sample_02.txt | AC | 3 ms | 256 KB |
sample_03.txt | AC | 3 ms | 256 KB |
subtask_1_invalid_01.txt | AC | 17 ms | 896 KB |
subtask_1_invalid_02.txt | AC | 5 ms | 384 KB |
subtask_1_max_01.txt | AC | 19 ms | 1024 KB |
subtask_1_max_02.txt | AC | 19 ms | 1024 KB |
subtask_1_max_valid_01.txt | AC | 19 ms | 1024 KB |
subtask_1_max_valid_02.txt | AC | 20 ms | 1024 KB |
subtask_1_min_valid_01.txt | AC | 3 ms | 256 KB |
subtask_1_rand_01.txt | AC | 13 ms | 768 KB |
subtask_1_rand_02.txt | AC | 18 ms | 1024 KB |
subtask_1_valid_01.txt | AC | 12 ms | 640 KB |
subtask_1_valid_02.txt | AC | 6 ms | 384 KB |