QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#138968#3013. XOR Sequenceskaruna#WA 1ms3368kbC++17826b2023-08-12 15:17:402023-08-12 15:18:26

Judging History

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

  • [2023-08-12 15:18:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3368kb
  • [2023-08-12 15:17:40]
  • 提交

answer

#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = (int)1e9 + 7;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);
	int m, n; cin >> m >> n;
	int k = (1 << m);
	int A[k];
	for(auto &i : A) cin >> i, --i;

	pii B[n];
	for(int i = 0; i < n; ++i) B[i] = {INF, -INF};
	for(int i = 0; i < k; ++i)
	{
		B[A[i]].ff = min(B[A[i]].ff, i);
		B[A[i]].ss = max(B[A[i]].ss, i);
	}

	long long sum = 0, ans = 1;
	for(int i = 0; i < n; ++i)
	{
		int x = B[i].ff, y = B[i].ss;
		if(y - x != (y ^ x)) return !(cout << 0);
		int z = y - x + 1;
		if(z & (z - 1)) return !(cout << 0);
		sum += z;
		ans = ans * z % INF;
	}

	if(sum != k) return !(cout << 0);

	cout << ans;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3368kb

input:

4 12
2
2
3
6
1
12
1
12
9
7
5
5
4
8
10
11

output:

0

result:

wrong answer expected 8, found 0