当前位置:网站首页>Cf:c. restoring the duration of tasks

Cf:c. restoring the duration of tasks

2022-06-11 18:47:00 Review of the white speed Dragon King

 Insert picture description here

analysis

You can get a classification according to the end time of the current task and the start time of the next task

ac code

for _ in range(int(input())):
    n = int(input())
    s = list(map(int, input().split()))
    f = list(map(int, input().split()))
    ans = []
    for i in range(n):
        if i == 0:
            ans.append(f[i] - s[i])
        else:
            if s[i] >= f[i - 1]:
                ans.append(f[i] - s[i])
            else:
                ans.append(f[i] - f[i - 1])
    for i in range(len(ans)):
        if i != len(ans) - 1:
            print(ans[i], end = ' ')
        else:
            print(ans[i])

summary

Find a regular expert

原网站

版权声明
本文为[Review of the white speed Dragon King]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111836366956.html