Contest Duration: ~ (local time) (180 minutes)

Submission #15566323

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;

#define mb __builtin_clz
int n, s = 0;
vector<int> v;

int solve();

int main() {
cin >> n;
v.resize(n);
for (auto &p : v) {
cin >> p;
s ^= p;
p = p ^ (p - 1);
}
cout << solve() << endl;
return 0;
}

int solve() {
if (!s) return 0;
sort(v.begin(), v.end(), greater<int>());
vector<int> basis;
int cnt = 0;
for (auto &p : v) {
for (auto b : basis) p = min(p, p ^ b);
if (p) {
basis.push_back(p);
if (s && (p >> (31 - mb(s)) & 1)) s ^= p, ++cnt;
}
// if (!s) return cnt;
}
for (int i = 1; i < basis.size(); ++i) assert(basis[i - 1] > basis[i]);
if (!s) return cnt;
return -1;
}```

#### Submission Info

Submission Time 2020-08-01 19:21:19+0900 C - Cheating Nim m_tsubasa C++ (GCC 9.2.1) 0 729 Byte WA 53 ms 3796 KB

#### Compile Error

```./Main.cpp: In function ‘int solve()’:
./Main.cpp:35:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
35 |   for (int i = 1; i < basis.size(); ++i) assert(basis[i - 1] > basis[i]);
|                   ~~^~~~~~~~~~~~~~
```

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0.txt, example1.txt
All 0 / 500 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt 6 ms 3560 KB
001.txt 3 ms 3472 KB
002.txt 39 ms 3428 KB
003.txt 17 ms 3416 KB
004.txt 29 ms 3428 KB
005.txt 28 ms 3548 KB
006.txt 47 ms 3528 KB
007.txt 53 ms 3796 KB
008.txt 45 ms 3632 KB
009.txt 40 ms 3748 KB
010.txt 44 ms 3448 KB
011.txt 45 ms 3584 KB
012.txt 39 ms 3708 KB
013.txt 45 ms 3444 KB
014.txt 46 ms 3428 KB
015.txt 48 ms 3728 KB
016.txt 42 ms 3420 KB
017.txt 47 ms 3708 KB
018.txt 42 ms 3728 KB
019.txt 43 ms 3500 KB
020.txt 42 ms 3432 KB
021.txt 11 ms 3540 KB
022.txt 12 ms 3544 KB
023.txt 41 ms 3728 KB
example0.txt 7 ms 3640 KB
example1.txt 2 ms 3608 KB