結果
| 問題 |
No.2895 Zero XOR Subset
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 22:09:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,606 bytes |
| コンパイル時間 | 2,117 ms |
| コンパイル使用メモリ | 198,608 KB |
| 最終ジャッジ日時 | 2025-02-24 10:15:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 WA * 15 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:70:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type’ {aka ‘long int’} [-Wformat=]
70 | printf("1\n%d\n", it - v.begin() + 1);
| ~^ ~~~~~~~~~~~~~~~~~~
| | |
| int __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type {aka long int}
| %ld
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<pdd> vpdd;
typedef vector<vd> vvd;
#define yn(ans) printf("%s\n", (ans)?"Yes":"No");
#define YN(ans) printf("%s\n", (ans)?"YES":"NO");
template<class T> bool chmax(T &a, T b) {
if (a >= b) return false;
a = b; return true;
}
template<class T> bool chmin(T &a, T b) {
if (a <= b) return false;
a = b; return true;
}
#define FOR(i, s, e, t) for ((i) = (s); (i) < (e); (i) += (t))
#define REP(i, e) for (int i = 0; i < (e); ++i)
#define REP1(i, s, e) for (int i = (s); i < (e); ++i)
#define RREP(i, e) for (int i = (e); i >= 0; --i)
#define RREP1(i, e, s) for (int i = (e); i >= (s); --i)
#define all(v) v.begin(), v.end()
#define pb push_back
#define qb pop_back
#define pf push_front
#define qf pop_front
#define maxe max_element
#define mine min_element
ll inf = 1e18;
#define DEBUG printf("%d\n", __LINE__); fflush(stdout);
template<class T> void print(vector<T> &v, bool withSize = false) {
if (withSize) cout << v.size() << endl;
REP(i, v.size()) cout << v[i] << " ";
cout << endl;
}
mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
int __FAST_IO__ = []() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
return 0;
}();
#define TESTS int t; cin >> t; while (t--)
#define TEST
int main() {
int N;
cin >> N;
vll v(N);
REP(i, N) cin >> v[i];
auto it = find(all(v), 0);
if (it != v.end()) {
printf("1\n%d\n", it - v.begin() + 1);
return 0;
}
vll base, q;
REP(i, N) {
int j = 0;
ll x = v[i];
ll mask = 1ll << i;
while (x > 0 && j < base.size()) {
int a = __lg(x), b = __lg(base[j]);
if (a > b) break;
else if (a == b) x ^= base[j], mask ^= q[j];
j++;
}
if (x == 0) {
printf("%d\n", __builtin_popcountll(mask));
REP(j, 60) {
if (mask >> j & 1) printf("%d ", j + 1);
}
return 0;
}
base.insert(base.begin() + j, x);
q.insert(q.begin() + j, mask);
}
printf("-1\n");
return 0;
}