結果
| 問題 | No.184 たのしい排他的論理和(HARD) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-25 01:22:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 908 bytes |
| 記録 | |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 59,548 KB |
| 最終ジャッジ日時 | 2025-11-30 14:20:02 |
| 合計ジャッジ時間 | 1,803 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:8:1: error: ‘uint64_t’ does not name a type
8 | uint64_t bit(int i) { return 1ull << i; }
| ^~~~~~~~
main.cpp:4:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
3 | #include <algorithm>
+++ |+#include <cstdint>
4 | #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
main.cpp:9:17: error: ‘uint64_t’ was not declared in this scope
9 | void add(vector<uint64_t> & xs, uint64_t y) {
| ^~~~~~~~
main.cpp:9:17: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
main.cpp:9:25: error: template argument 1 is invalid
9 | void add(vector<uint64_t> & xs, uint64_t y) {
| ^
main.cpp:9:25: error: template argument 2 is invalid
main.cpp:9:33: error: ‘uint64_t’ has not been declared
9 | void add(vector<uint64_t> & xs, uint64_t y) {
| ^~~~~~~~
main.cpp: In function ‘void add(int&, int)’:
main.cpp:10:10: error: ‘uint64_t’ was not declared in this scope
10 | for (uint64_t x : xs) {
| ^~~~~~~~
main.cpp:10:10: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
main.cpp:17:5: error: expected primary-expression before ‘if’
17 | if (y) {
| ^~
main.cpp:16:6: error: expected ‘;’ before ‘if’
16 | }
| ^
| ;
17 | if (y) {
| ~~
main.cpp:17:5: error: expected primary-expression before ‘if’
17 | if (y) {
| ^~
main.cpp:16:6: error: expected ‘)’ before ‘if’
16 | }
| ^
| )
17 | if (y) {
| ~~
main.cpp:10:9: note: to match this ‘(’
10 | for (uint64_t x : xs) {
| ^
main.cpp:18:12: error: request for member ‘push_back’ in ‘xs’, which is of non-class type ‘int’
18 | xs.push_back(y)
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;
uint64_t bit(int i) { return 1ull << i; }
void add(vector<uint64_t> & xs, uint64_t y) {
for (uint64_t x : xs) {
repeat_reverse (i,64) {
if (not (x & bit(i)) and not (y & bit(i))) continue;
if ((x & bit(i)) and (y & bit(i))) y ^= x;
break;
}
}
if (y) {
xs.push_back(y);
whole(sort, xs);
whole(reverse, xs);
}
}
int main() {
int n; cin >> n;
vector<uint64_t> acc;
repeat (i,n) {
uint64_t a; cin >> a;
add(acc, a);
}
cout << (1ll << acc.size()) << endl;
return 0;
}