QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#677815 | #9249. Elimination Series Once More | veg# | WA | 1ms | 7876kb | C++20 | 581b | 2024-10-26 13:28:40 | 2024-10-26 13:28:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n, k, a[1 << 20 | 5], idx[1 << 20 | 5], ans[1 << 20 | 5], t[1 << 20 | 5];
int main() {
scanf("%d%d", &n, &k);
for (int i = 1; i <= 1 << n; ++i) {
scanf("%d", &a[i]);
idx[a[i]] = i;
}
for (int i = 1 << n; i >= 1; --i) {
int p = idx[i], len = 2;
while (p) {
if (t[p] <= k && i >= len) {
++ans[idx[i]];
p >>= 1;
len <<= 1;
} else
break;
}
p = idx[i];
while (p) {
t[p] += 1;
p >>= 1;
}
}
for (int i = 1; i <= 1 << n; ++i) printf("%d ", ans[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 7844kb
input:
2 1 1 2 3 4
output:
0 1 1 2
result:
ok 4 number(s): "0 1 1 2"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 7876kb
input:
3 5 2 4 7 5 3 8 6 1
output:
0 2 2 2 1 3 2 0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'