QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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()
Details
Tip: Click on the bar to expand more detailed information
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'