QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#795017 | #7963. 多折较差验证 | thelongXiao# | WA | 13ms | 10764kb | Python3 | 727b | 2024-11-30 17:27:31 | 2024-11-30 17:27:31 |
Judging History
answer
def main():
n = int(input())
s = input()
v_count = [0] * (n + 1)
for i in range(n):
if s[i] == 'v':
v_count[i + 1] = v_count[i] + 1
else:
v_count[i + 1] = v_count[i] - 1
max_sub = [0] * (n + 1)
max_sum = 0
sum = 0
for i in range(n + 1):
max_sum = max(max_sum, sum)
max_sub[i] = max_sum
sum += v_count[i]
if sum < 0:
sum = 0
fold_count = n - 1
elm = 0
for i in range(n):
if s[i] == 'v':
elm += max_sub[-1] - max_sub[i + 1]
else:
elm += max_sub[i] - max_sub[-1]
print(fold_count, elm)
if __name__ == "__main__":
main()
详细
Test #1:
score: 0
Wrong Answer
time: 13ms
memory: 10764kb
input:
5000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
output:
4999 0
result:
wrong answer 1st lines differ - expected: '5000 12497500', found: '4999 0'