编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#20634 #1001. A. 神秘谜题 Wrong Answer 0 275 ms 15900 K C++ / 1.2 K 电类809-廖原 2019-07-27 21:51:01
显示原始代码
#include <cstdio>
#include <algorithm>
#include <vector>
#define ULL unsigned long long
#define LL long long
using namespace std;
char ch;
bool fh;
inline void read(int &a) {
    for (fh = 0, ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-')
            fh = 1;
    for (a = 0; ch >= '0' && ch <= '9'; ch = getchar()) (a *= 10) += ch - '0';
    if (fh)
        a = -a;
}
struct node {
    int s[2];  // s[0]表示0,s[1]表示1
};
node Trie[32 * 200010];
int Ttop;
int Size[32 * 200010];
int n;
int A[32];
int cnt;
inline void insert(int x) {
    int u, l, p;
    for (u = 0; u < 32; u++) A[u] = 0;
    for (p = 1, l = 0; x; p = Trie[p].s[u], x >>= 1, l++) {
        u = x & 1;
        Size[p]++;
        A[l] ^= u;
        if (!Trie[p].s[u])
            Trie[p].s[u] = ++Ttop;
    }
    Size[p]++;
}
void Plus(int p, int l) {
    if (!(Trie[p].s[0] | Trie[p].s[1])) {
        Trie[p].s[1] = ++Ttop;
        Size[Ttop] = Size[p];
        A[l] ^= (Size[Ttop] & 1);
        return;
    }
    swap(Trie[p].s[0], Trie[p].s[1]);
    A[l] ^= (Size[Trie[p].s[0]] & 1) ^ (Size[Trie[p].s[1]] & 1);
    if (Trie[p].s[0])
        Plus(Trie[p].s[0], l + 1);
}
inline int Count() {
    int vi, l, x = 0;
    for (vi = 0, l = 1; vi < 31; vi++, l <<= 1)
        if (A[vi])
            x += l;
    return x;
}
int main() {
    int vi, opt, x;
    Ttop = 1;
    read(n);
    for (vi = 1; vi <= n; vi++) {
        read(opt);
        if (opt == 2) {
            read(x);
            insert(x);
            cnt ^= 1;
        } else
            Plus(1, 0);
        x = Count();
        printf("%d\n", x);
    }
}
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:144 ms
内存:15896 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>

用户输出

526767110
724642759
567837900
104106873
357915481
33997211
444788944
740962380
692646851
979301896
840737399
969854580
898316256
<1992983 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:131 ms
内存:15900 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>

用户输出

515979308
512702340
684230440
488136957
598252313
283603971
349877373
238027330
54154885
4873360
916621931
75205470
566613723
83
<1983003 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0