結果
| 問題 |
No.2895 Zero XOR Subset
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-09-20 21:55:40 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,277 bytes |
| コンパイル時間 | 3,962 ms |
| コンパイル使用メモリ | 270,736 KB |
| 実行使用メモリ | 821,536 KB |
| 最終ジャッジ日時 | 2024-09-20 21:55:55 |
| 合計ジャッジ時間 | 7,841 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | MLE * 1 -- * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;
int main() {
int N;
cin >> N;
vector<pair<ll, int>> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i].first;
A[i].second = i;
}
ranges::sort(A);
for (int i = 0; i < N; i++) {
if (A[i].first == 0) {
cout << 1 << endl;
cout << A[i].second + 1 << endl;
return 0;
}
}
for (int i = 0; i < N - 1; i++) {
if (A[i].first == A[i + 1].first) {
cout << 2 << endl;
cout << A[i].second + 1 << " " << A[i + 1].second + 1 << endl;
return 0;
}
}
map<ll, vector<int>> mp;
mp[0].push_back({-1});
for (int i = 0; i < N; i++) {
if (mp.count(A[i].first)) {
cout << mp[A[i].first].size() << endl;
for (int j : mp[A[i].first]) {
if (j == -1) continue;
cout << j + 1 << " ";
}
cout << A[i].second + 1 << endl;
return 0;
}
for (auto p : mp) {
mp[p.first ^ A[i].first] = p.second;
mp[p.first ^ A[i].first].push_back(A[i].second);
}
}
cout << -1 << endl;
}
Today03