QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#138968 | #3013. XOR Sequences | karuna# | WA | 1ms | 3368kb | C++17 | 826b | 2023-08-12 15:17:40 | 2023-08-12 15:18:26 |
Judging History
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