QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#56094 | #3013. XOR Sequences | YaoBIG# | WA | 1ms | 3560kb | C++ | 797b | 2022-10-16 22:39:13 | 2022-10-16 22:39:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
int h = 1 << n;
vector<int> cs(h);
for (int& c : cs) cin >> c;
vector<pair<int, int>> itv(m);
for (int i = 0; i < m; ++i) itv[i] = {h, -1};
for (int i = 0; i < h; ++i) {
int v = cs[i] - 1;
itv[v].first = min(itv[v].first, i);
itv[v].second = max(itv[v].second, i);
}
sort(itv.begin(), itv.end());
ll res = 1;
int lst = -1;
for (int i = 0; i < m; ++i) {
int a = itv[i].first;
int b = itv[i].second;
if (lst >= a) res = 0;
lst = b;
int len = b - a + 1;
if (__builtin_popcount(len) > 1) res = 0;
if (a % len != 0) res = 0;
res = (res * len) % MOD;
}
cout << res << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3560kb
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