QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725106#9541. Expanding Arrayzhoukangyang#WA 0ms3780kbC++14746b2024-11-08 16:17:212024-11-08 16:17:21

Judging History

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

  • [2024-11-08 16:17:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-11-08 16:17:21]
  • 提交

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define sz(a) ((int) (a).size())
#define ll long long 
#define vi vectoe<int>
#define pb emplace_back
using namespace std;
const int N = 1 << 19, mod = 1e8 + 7;
int n;
int a[N];
int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	L(i, 1, n) cin >> a[i];
	set<int>ans;
	L(i, 1, n) ans.insert(a[i]);
	L(i, 1, n - 1) {
		int v[3] = {0, 0, 0};
		v[0] = a[i] ^ a[i + 1];
		v[1] = a[i] ^ v[0];
		v[2] = a[i] ^ v[1];
		L(s, 0, (1 << 3) - 1) {
			int val = 0;
			L(j, 0, 2) if(s >> j & 1)val ^= v[j];
			ans.insert(val);
		}
	}
	cout << sz(ans) << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

4

result:

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