编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#21238 #1001. A. 神秘谜题 Runtime Error 0 6 ms 392 K C++ 11 / 1.0 K Rhodoks 2020-01-30 15:15:07
显示原始代码
#include <bits/stdc++.h>
#define DB double
#define LL long long

#define MST(a, b) memset((a), (b), sizeof(a))
#define MRK() cout << "Mark" << endl;
#define WRT(x) cout << #x << " = " << (x) << endl;

#define MAXN 210000
#define MAXM 410000
#define MOD 998244353
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-5

#define _ 0
using namespace std;

int son[MAXN << 30][2];
int cnt[MAXN << 30];
int ans;
int ncnt = 1;
void insert(int x) {
    int pos = 1;
    for (int i = 0; i < 30; i++) {
        int to = (x & (1 << i) && 1);
        if (to)
            ans ^= (1 << i);
        if (!son[pos][to])
            son[pos][to] = ++ncnt;
        pos = son[pos][to];
        cnt[pos]++;
    }
}

#define LS son[pos][0]
#define RS son[pos][1]

void add(int pos, int x) {
    swap(LS, RS);
    if (cnt[RS] ^ cnt[LS])
        ans ^= x;
    if (x < 29)
        add(LS, x << 1);
}

int main() {
    int n, op, x;
    cin >> n;
    while (n--) {
        scanf("%d", &op);
        if (op == 1)
            add(1, 1);
        else {
            scanf("%d", &x);
            insert(x);
        }
        printf("%d\n", ans);
    }
    return ~~(0 ^ _ ^ 0);
}
子任务 #1
Runtime Error
得分:0
测试点 #1
Runtime Error
得分:0
用时:4 ms
内存:392 KiB

输入文件(1.in

200000
2 526767110
2 724642759
2 567837900
2 104106873
2 357915481
2 33997211
2 444788944
2 
<1586974 bytes omitted>

答案文件(1.ans

526767110
877985729
361528077
330887284
116239149
82537142
510237286
843295274
453728745
55
<2188330 bytes omitted>

系统信息

Killed: Segmentation fault
测试点 #2
Runtime Error
得分:0
用时:2 ms
内存:384 KiB

输入文件(2.in

200000
2 515979308
2 512702340
2 684230440
2 488136957
2 598252313
2 283603971
2 349877373
2
<1586842 bytes omitted>

答案文件(2.ans

515979308
5115816
679905408
899606653
372667236
114362215
302756634
473674072
520218589
525
<2192841 bytes omitted>

系统信息

Killed: Segmentation fault