QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#877765 | #9736. Kind of Bingo | 1903331632 | WA | 41ms | 10100kb | Python3 | 1.2kb | 2025-02-01 04:40:11 | 2025-02-01 04:40:11 |
Judging History
answer
import sys
def main():
input = sys.stdin.read().split()
ptr = 0
T = int(input[ptr])
ptr += 1
for _ in range(T):
n = int(input[ptr])
m = int(input[ptr+1])
k = int(input[ptr+2])
ptr +=3
nm = n * m
p = list(map(int, input[ptr:ptr+nm]))
ptr += nm
# 预处理:单元格编号到位置的映射
pos_dict = {}
for idx, cell in enumerate(p):
pos_dict[cell] = idx + 1 # 位置是1-based的
min_bingo = float('inf')
for i in range(1, n+1):
start = (i-1)*m + 1
end = i*m
positions = []
for cell in range(start, end+1):
positions.append(pos_dict[cell])
positions.sort()
if m == 0:
continue
if k >= m:
current_max = m
else:
if m - k <= 0:
current_max = m
else:
current_max = positions[m - k -1]
if current_max < min_bingo:
min_bingo = current_max
print(min_bingo)
if __name__ == '__main__':
main()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 10ms
memory: 8704kb
input:
3 3 5 2 1 4 13 6 8 11 14 2 7 10 3 15 9 5 12 2 3 0 1 6 4 3 5 2 2 3 1000000000 1 2 3 4 5 6
output:
7 5 3
result:
ok 3 number(s): "7 5 3"
Test #2:
score: -100
Wrong Answer
time: 41ms
memory: 10100kb
input:
10000 1 9 7 8 9 1 5 3 7 4 6 2 1 8 2 7 5 1 6 4 2 3 8 1 1 0 1 1 8 3 5 7 8 3 2 1 4 6 1 10 948645336 3 10 1 6 2 8 9 5 7 4 1 1 0 1 1 10 7 5 3 10 8 1 7 4 9 6 2 1 9 6 4 8 5 7 2 6 3 1 9 1 7 1 3 5 1 6 2 7 4 1 6 6 5 3 1 2 4 6 1 1 1 1 1 2 0 1 2 1 1 1 1 1 6 3 5 6 2 4 3 1 1 5 673454194 2 3 1 4 5 1 4 1 1 4 2 3 1 ...
output:
2 6 1 5 10 1 3 3 6 6 1 2 1 3 5 3 1 3 3 3 6 4 9 10 3 6 2 1 3 1 2 5 6 1 3 1 3 9 1 1 4 2 8 4 3 1 5 6 1 4 7 1 6 5 2 2 7 1 2 6 8 7 1 2 6 2 2 1 2 4 4 3 1 2 1 1 2 1 4 7 2 3 1 1 2 3 3 2 4 1 8 2 4 1 2 4 1 4 4 6 9 6 4 4 2 3 6 2 2 6 6 10 7 6 1 3 2 3 8 3 4 4 5 6 2 7 5 5 5 3 3 2 6 4 7 4 7 8 8 1 1 2 5 2 3 10 4 2 ...
result:
wrong answer 1st numbers differ - expected: '9', found: '2'