# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
236594 |
2020-06-02T14:19:20 Z |
Vimmer |
Dojave (COCI17_dojave) |
C++14 |
|
263 ms |
44804 KB |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 1005000
#define M ll(1e9 + 7)
#define inf 1e9 + 1e9
using namespace std;
//using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef short int si;
typedef array <int, 2> a2;
//typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937_64 rnd(chrono::system_clock().now().time_since_epoch().count());
ull val[N], ans = 0;
unordered_map <ull, unordered_map <int, int> > mp;
int main()
{
//freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// srand(time(0));
ll n;
cin >> n;
if (n == 1) {cout << 2 << endl; exit(0);}
n = (1 << n);
ll a[n];
for (ll i = 0; i < n; i++) cin >> a[i];
for (ll i = 0; i < n; i++)
{
ll vl = (n - 1) ^ i;
if (vl < i) continue;
val[i] = rnd();
val[vl] = ull(0) - val[i];
}
mp[0][0]++;
ull sum = 0;
int xr = 0;
for (ll i = 0; i < n; i++)
{
sum += val[a[i]];
xr ^= a[i];
ans += mp[sum][xr];
mp[sum][xr]++;
}
cout << (ull(n) * ull(n + 1)) / ull(2) - ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
896 KB |
Output is correct |
2 |
Correct |
6 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
1184 KB |
Output is correct |
2 |
Correct |
9 ms |
1792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
3200 KB |
Output is correct |
2 |
Correct |
11 ms |
2048 KB |
Output is correct |
3 |
Correct |
10 ms |
1792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
11400 KB |
Output is correct |
2 |
Correct |
31 ms |
6952 KB |
Output is correct |
3 |
Correct |
71 ms |
15624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
11400 KB |
Output is correct |
2 |
Correct |
76 ms |
13448 KB |
Output is correct |
3 |
Correct |
192 ms |
36276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
263 ms |
44804 KB |
Output is correct |
2 |
Correct |
169 ms |
26632 KB |
Output is correct |
3 |
Correct |
179 ms |
32444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
141 ms |
17144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
130 ms |
17144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |