Submission #62094322
Source Code Expand
Copy
#include<bits/stdc++.h>#include<random>using namespace std;typedef long long ll;typedef unsigned long long ull;#define endl '\n'using pll = pair<ll, ll>;using pii = pair<int, int>;const int N = 2e6 + 10;mt19937 rnd(114514);ll a[N], n;map<ll, ll>vis;map<vector<ll>, bool>isok;vector<ll>tot;void dfs(int x, vector<ll>v) {if (x > n) {ll sum = 0;for (const ll it : v)sum ^= it;tot.push_back(sum);return;
#include<bits/stdc++.h> #include<random> using namespace std; typedef long long ll; typedef unsigned long long ull; #define endl '\n' using pll = pair<ll, ll>; using pii = pair<int, int>; const int N = 2e6 + 10; mt19937 rnd(114514); ll a[N], n; map<ll, ll>vis; map<vector<ll>, bool>isok; vector<ll>tot; void dfs(int x, vector<ll>v) { if (x > n) { ll sum = 0; for (const ll it : v)sum ^= it; tot.push_back(sum); return; } if (isok[v])return; isok[v] = 1; for (auto &V : v) { V += a[x]; dfs(x + 1, v); V -= a[x]; } v.push_back(a[x]); dfs(x + 1, v); v.pop_back(); } void UraykevoliQwQ() { cin >> n; for (int i = 1; i <= n; i++)cin >> a[i]; dfs(1, {}); //cout << vis.size(); sort(tot.begin(), tot.end()); tot.erase(unique(tot.begin(), tot.end()), tot.end()); cout << tot.size(); } int main() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); int _ = 1; //cin >>_; while (_--)UraykevoliQwQ(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Stone XOR |
User | irohika |
Language | C++ 20 (gcc 12.2) |
Score | 400 |
Code Size | 1007 Byte |
Status | AC |
Exec Time | 858 ms |
Memory | 174788 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt, example_02.txt |
All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 1 ms | 3368 KB |
example_01.txt | AC | 1 ms | 3452 KB |
example_02.txt | AC | 1 ms | 3476 KB |
hand_00.txt | AC | 2 ms | 3744 KB |
hand_01.txt | AC | 609 ms | 119496 KB |
hand_02.txt | AC | 589 ms | 174764 KB |
hand_03.txt | AC | 806 ms | 141892 KB |
hand_04.txt | AC | 1 ms | 3468 KB |
hand_05.txt | AC | 571 ms | 114628 KB |
random_00.txt | AC | 21 ms | 7220 KB |
random_01.txt | AC | 1 ms | 3472 KB |
random_02.txt | AC | 1 ms | 3408 KB |
random_03.txt | AC | 2 ms | 3656 KB |
random_04.txt | AC | 845 ms | 174788 KB |
random_05.txt | AC | 655 ms | 174740 KB |
random_06.txt | AC | 12 ms | 5972 KB |
random_07.txt | AC | 1 ms | 3276 KB |
random_08.txt | AC | 577 ms | 125224 KB |
random_09.txt | AC | 15 ms | 6524 KB |
random_10.txt | AC | 719 ms | 174748 KB |
random_11.txt | AC | 18 ms | 7204 KB |
random_12.txt | AC | 18 ms | 7184 KB |
random_13.txt | AC | 806 ms | 174780 KB |
random_14.txt | AC | 110 ms | 26252 KB |
random_15.txt | AC | 849 ms | 174644 KB |
random_16.txt | AC | 858 ms | 174760 KB |
random_17.txt | AC | 21 ms | 7180 KB |
random_18.txt | AC | 21 ms | 7176 KB |
random_19.txt | AC | 1 ms | 3456 KB |
random_20.txt | AC | 1 ms | 3380 KB |
random_21.txt | AC | 807 ms | 174740 KB |
random_22.txt | AC | 21 ms | 7184 KB |
random_23.txt | AC | 1 ms | 3464 KB |
random_24.txt | AC | 121 ms | 26360 KB |
random_25.txt | AC | 13 ms | 6152 KB |
random_26.txt | AC | 1 ms | 3408 KB |
random_27.txt | AC | 77 ms | 20240 KB |
random_28.txt | AC | 17 ms | 7168 KB |
random_29.txt | AC | 499 ms | 115028 KB |