编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#113972 #1398. 与或和的异或 Accepted 100 764 ms 16712 K C++ 11 / 862 B slayerzzj 2024-07-14 15:10:41
显示原始代码
#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], Sand[100005][20], Sor[100005][20];
int qand(int l, int r) {
    int len = log(r - l) / log(2);
    return Sand[l][len] & Sand[r - (1 << len) + 1][len];
}
int qor(int l, int r) {
    int len = log(r - l) / log(2);
    return Sor[l][len] | Sor[r - (1 << len) + 1][len];
}
inline int read_() {
    int ret = 0, f = 1;
    char ch = getchar();
    for (; ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-')
            f = -f;
    for (; ch >= '0' && ch <= '9'; ch = getchar()) ret = (ret << 1) + (ret << 3) + (ch ^ 48);
    return ret * f;
}
int main() {
    n = read_();
    m = read_();
    for (int i = 1; i <= n; i++) Sand[i][0] = Sor[i][0] = a[i] = read_();
    for (int j = 1; j <= log(n) / log(2); j++)
        for (int i = 1; i <= n - (1 << j) + 1; i++)
            Sand[i][j] = Sand[i][j - 1] & Sand[i + (1 << j - 1)][j - 1],
            Sor[i][j] = Sor[i][j - 1] | Sor[i + (1 << j - 1)][j - 1];
    int l, r;
    for (int i = 1; i <= m; i++) {
        l = read_(), r = read_();
        printf("%d\n", qand(l, r) ^ qor(l, r));
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:4 ms
内存:336 KiB

输入文件(1.in

10 10
600 399 612 447 615 383 424 384 408 446
7 8
4 10
8 9
3 6
8 9
3 3
4 7
2 10
5 10
7 9

答案文件(1.out

40
1023
24
987
24
0
991
1023
1023
56

用户输出

40
1023
24
987
24
0
991
1023
1023
56

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:3 ms
内存:344 KiB

输入文件(2.in

100 100
448 0 73737727 602931199 73741822 73741822 73741822 516351 0 73741807 73741822 262143 0 0 73
<1159 bytes omitted>

答案文件(2.out

1073741823
479906304
1073741823
1023410175
1073741823
1023410175
1073741823
1073741823
1073741823
10
<948 bytes omitted>

用户输出

1073741823
479906304
1073741823
1023410175
1073741823
1023410175
1073741823
1073741823
1073741823
1073741823
1073741823
73793535
<920 bytes omitted>

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:5 ms
内存:452 KiB

输入文件(3.in

1000 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 73709055 73741822 73741822 73741822 73741822 73741822 73741822
<12851 bytes omitted>

答案文件(3.out

75446271
75446271
1073741823
536870911
536870911
1073741823
536870911
0
1073741823
536870911
1073741
<10093 bytes omitted>

用户输出

75446271
75446271
1073741823
536870911
536870911
1073741823
536870911
0
1073741823
536870911
1073741823
620756991
939524095
8388
<10065 bytes omitted>

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:6 ms
内存:760 KiB

输入文件(4.in

3000 3000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 73741567 73741822 73741822 73741822 73741822 73741
<44044 bytes omitted>

答案文件(4.out

73793535
536870911
1073741823
1073741823
1073741823
73741823
1073741823
1073741823
610795519
0
53687
<30300 bytes omitted>

用户输出

73793535
536870911
1073741823
1073741823
1073741823
73741823
1073741823
1073741823
610795519
0
536870911
1073741823
1073741823
1
<30272 bytes omitted>

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:4 ms
内存:844 KiB

输入文件(5.in

3000 3000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 737418
<44622 bytes omitted>

答案文件(5.out

1073741823
939524095
939524095
73610751
73741823
1073741823
939524095
805306367
73872895
1073741823

<29285 bytes omitted>

用户输出

1073741823
939524095
939524095
73610751
73741823
1073741823
939524095
805306367
73872895
1073741823
939524095
125646335
10737418
<29257 bytes omitted>

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:45 ms
内存:16356 KiB

输入文件(6.in

100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
<1715989 bytes omitted>

答案文件(6.out

134217727
134217727
671088639
134217727
134217727
75497471
134217727
134217727
132464639
134217727
1
<950853 bytes omitted>

用户输出

134217727
134217727
671088639
134217727
134217727
75497471
134217727
134217727
132464639
134217727
134217727
132464639
75497471

<950825 bytes omitted>

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:48 ms
内存:16420 KiB

输入文件(7.in

100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
<1777038 bytes omitted>

答案文件(7.out

0
1073741823
536870911
536870911
805306367
536870911
268435455
536870911
1073741823
536870911
107374
<1003012 bytes omitted>

用户输出

0
1073741823
536870911
536870911
805306367
536870911
268435455
536870911
1073741823
536870911
1073741823
536870911
536870911
107
<1002984 bytes omitted>

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:54 ms
内存:16356 KiB

输入文件(8.in

100000 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
<1721061 bytes omitted>

答案文件(8.out

73742335
939524095
1073741823
1073741823
83886079
1073741823
1073741823
1073741823
1073741823
739246
<982751 bytes omitted>

用户输出

73742335
939524095
1073741823
1073741823
83886079
1073741823
1073741823
1073741823
1073741823
73924607
73742335
939524095
0
1073
<982723 bytes omitted>

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:307 ms
内存:16712 KiB

输入文件(9.in

100000 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<12313367 bytes omitted>

答案文件(9.out

134217727
268435455
134217727
0
73741823
75497471
268435455
73741823
268435455
671088639
134217727
1
<9575301 bytes omitted>

用户输出

134217727
268435455
134217727
0
73741823
75497471
268435455
73741823
268435455
671088639
134217727
1073741823
268435455
26843545
<9575273 bytes omitted>

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:288 ms
内存:16712 KiB

输入文件(10.in

100000 1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<12341878 bytes omitted>

答案文件(10.out

0
1073741823
1073741823
1073741823
1073741823
939524095
1073741823
1073741823
268435455
125829119
10
<10119387 bytes omitted>

用户输出

0
1073741823
1073741823
1073741823
1073741823
939524095
1073741823
1073741823
268435455
125829119
1073741823
73924607
1073741823
<10119359 bytes omitted>

系统信息

Exited with return code 0