QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#286137 | #7942. $K$ Subsequences | ucup-team008# | WA | 9ms | 8956kb | Python3 | 572b | 2023-12-17 03:46:27 | 2023-12-17 03:46:27 |
Judging History
answer
import sys
input = sys.stdin.readline
def solve():
n, k = (int(x) for x in input().split())
lhs = [str(i+1) for i in range(k)]
rhs = []
l = [int(x) for x in input().split()]
ret = []
for y in l:
if y == 1:
if not lhs:
lhs, rhs = rhs, lhs
rhs.append(lhs.pop())
ret.append(rhs[-1])
else:
if not rhs:
lhs, rhs = rhs, lhs
lhs.append(rhs.pop())
ret.append(lhs[-1])
return " ".join(ret)
ret = []
for _ in range(int(input())):
ret.append(solve())
print("\n".join(ret))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 9ms
memory: 8956kb
input:
5 3 2 1 -1 1 4 2 -1 1 1 -1 7 3 1 1 1 1 1 1 1 10 3 1 1 1 1 -1 -1 1 1 1 1 12 4 1 1 1 1 -1 -1 -1 -1 1 1 1 1
output:
2 2 2 2 2 2 2 3 2 1 1 2 3 3 3 2 1 1 1 1 1 1 2 3 4 3 2 1 1 2 3 4 4 3 2 1
result:
wrong answer Jury found better answer than participant (test case 2)