QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749724#9541. Expanding ArrayForever_Young#WA 0ms3832kbC++20784b2024-11-15 09:42:252024-11-15 09:42:26

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 09:42:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-11-15 09:42:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int a[100010];

int main() {
  int n;
  scanf("%d", &n);
  set<int> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s.insert(a[i]);
  }
  s.insert(0);
  for (int i = 1; i < n; i++) {
    int x = a[i];
    int y = a[i + 1];
    s.insert(x | y);
    s.insert((x | y) - x);
    s.insert((x | y) - y);
    s.insert(x & y);
    s.insert(x - (x & y));
    s.insert(y - (x & y));
    // int v[3] = {x & y, x ^ (x & y), y ^ (x & y)};
    // // s.insert(0);
    // s.insert(v[0]);
    // s.insert(v[1]);
    // s.insert(v[2]);
    // s.insert(v[0] | v[1]);
    // s.insert(v[0] | v[2]);
    // s.insert(v[1] | v[2]);
    // s.insert(v[0] | v[1] | v[2]);
  }
  printf("%d\n", int(s.size()));
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3760kb

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3832kb

input:

2
3 5

output:

7

result:

wrong answer 1st lines differ - expected: '8', found: '7'