QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#567372#9313. Make Maxzsy0701RE 0ms0kbPython3749b2024-09-16 11:31:472024-09-16 11:31:47

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 15:56:24]
  • hack成功,自动添加数据
  • (/hack/836)
  • [2024-09-16 11:31:47]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-09-16 11:31:47]
  • 提交

answer

import sys

def main():
    import threading
    def solve():
        t = int(sys.stdin.readline())
        for _ in range(t):
            n = int(sys.stdin.readline())
            a = list(map(int, sys.stdin.readline().split()))
            max_val = a[-1]
            ans = 0
            len_seg = 1
            i = n - 2
            while len_seg < n:
                if i < 0:
                    ans += 1
                    len_seg *= 2
                    continue
                if a[i] == max_val:
                    len_seg += 1
                    i -=1
                else:
                    ans +=1
                    len_seg *=2
            print(ans)
    threading.Thread(target=solve).start()
main()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

4
2
1 2
2
2 2
7
1 1 1 2 2 2 2
3
1 2 3

output:


result: