先上图
测试1
官网给的2000测试集 和 运行结果对比图
附代码,求评论为什么没分
n, m, k = map(int, (input().split()))
M = [0] * (m + 1)
p = [0]*(m+1)
out = [0] * k
M_old = []
P_old = []
for i in range(k):
count = 0
operation = list(map(int, input().split()))
if operation[0] == 0:
for j in range(operation[2], operation[3] + 1):
if M[j] != 0 and M[j] != operation[1] :
if count <= 0:
out[i] = -1
break
else:
M[j] = operation[1]
out[i] = j
p[j] = operation[4]
count += 1
elif operation[0] == 1:
if 0 not in M[operation[2]:operation[3] + 1]:
P_old = p.copy()
M_old = M.copy()
p[operation[2]:operation[3] + 1] = [0]*(operation[3]-operation[2]+1)
M[operation[2]:operation[3] + 1] = [0]*(operation[3]-operation[2]+1)
out[i] = "OK"
else:
out[i] = "FAIL"
elif operation[0] == 2:
for j in range(operation[2],operation[3]+1):
if M[j] == 0 and M_old[j] == operation[1]:
count += 1
if count == (operation[3]-operation[2]+1):
M[operation[2]:operation[3]+1] = M_old[operation[2]:operation[3]+1]
p[operation[2]:operation[3]+1] = P_old[operation[2]:operation[3]+1]
out[i] = "OK"
else:
out[i] = "FAIL"
else:
out[i] = [M[operation[1]],p[operation[1]]]
for i in out:
if type(i) == list:
print(i[0],end=' ')
print(i[1])
continue
print(i)
运行结果:
最后
以上就是着急天空最近收集整理的关于csp202112-4 磁盘文件操作 之吐槽【详细见文章】先上图附代码,求评论为什么没分运行结果:的全部内容,更多相关csp202112-4内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复